Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

dsPIC

Status
Not open for further replies.

Oznog

Active Member
Anybody else using a dsPIC?
I've been working on a project to use the noise suppression functions.
Man, there's a LOT of neat stuff going on here. dsPIC is cool! More advanced peripherals for one. It's a 16-bit core and just shedding the old concepts of the way code has to work takes some getting used to, and I'm coding in C. I mean, just picking up a peripheral reg I needed and seeing it's 16 bits wide but will still be written in one cycle is kind of a funky thought.
 
I've been using dsPICs for a while now in both commercial and hobbiest projects. They are packed very tight with all kinds of features and peripherals. For the most part I've been programming them in C but I write DSP routines in assembly.

They have all sorts of features like addressing modes, alternate interrupt vector tables, hardware traps, dynamically scalable clocks, and a ton of other stuff.

Pretty soon I'm going to be playing around with Microchip's TCP/IP stack for the dsPIC which they have available for free. I'm looking to do some home brew web based automation and audio distribution with them.

I'm looking forward to trying out the new dsPIC33F devices (and PIC24). Their cores are going to run 1 instruction every 2 clocks instead of 4 like current PICs. They will also be 3.3V devices running at 40MIPS!
 
I'm waiting on those ds33F devices too. I saw with the ds30F6012 I can get 20 MIPS with 3.3v & 50mA, if we go to 5v the current almost doubles to 90mA (and of course the voltage is higher) leading to a much higher power consumption. If you go to 30 MIPS, the chip can do it, but power consumption goes to 735mW, about 4.5x greater than 20MIPS @3.3v, just to get another 50% in speed. The chip would get pretty hot and may even have cooling issues.

Have you dealt with the "fractional" type here? I'm not clear on how math works with this type. I wanted to sample a block of audio from 3 channels, run NoiseSuppression on it, then mix the 3 levels and output it on one channel. Since the values are already in blocks, it seems like a great idea to do matrix operations to adjust the levels and add them together. But the libraries I found which had a matrix op involved "fractional" types (the block would be in signed int) and I can't find a clear description of how this type works.

Also, thoughts on this- this would normally take in audio from an electronically amplified condensor mike, with a signal level of around 1vPP. But I also wanted to make it compatible with another type of headset which uses an older magnet-and-coil microphone, which I measured with a signal level of around 20mV PP. As always board space is at a premium and components cost money, so I had the idea that instead of including a 50:1 op amp for those signals I could lower Vref+ and Vref- on the 12-bit ADC. Or maybe being a 12-bit (especially if it's going to be 3.3v) it will get a good enough resolution in itself? I'm concerned about noise, distortion, and problems with a low resolution on this input stage.
 
phalanx

Does the dsPIC with the TCP/IP stack have the ethernet chip onboard as well, or you still need the chip and matching parts?

Darn, might swing me back to Microchip if so.
 
Oz, the fractional type is actually prety easy and is explained in the dsPIC Family Reference Manual starting in section 2.6.1 (page 40 of the PDF). Breaking down the binary integer 0b0101, you get: 0^3+2^2+0^1+2^0 = 5. The fractional type breakdown looks like this: (first bit is the sign 0=+) 2^-1+0^-2+2^-3 = 0.625

Pay close attention to the accumulators. They are capable of accepting data in the Q.31 format which can give you a range of -256 to 256-2^-31. There are a bunch of functions in the C30 compiler that will convert floating point values to fractional types so the dsPIC can work on them natively. This can seriously increase the processing power of the chip.

About the power, you are right about them getting hot when clocked at 30MIPS. I use the 30F6014A in a number of projects and 2 of them need all of the performance at times. The first time I programmed it, I left everything in high speed mode and the chip got hot enough that I didn't want to leave my finger on it. I measured the temp and it was in the operating range of it. Regardless of wether or not the chip can work at that temperature, there is no doubt that elevated temps can lower the MTBF of the part which isn't good in a comercial application. Fortunately there are a number of features in the PIC to switch or scale the clock. On the fly, you can change to a different oscillator to reduce the clock speed. If you don't have another oscillator, you can change a clock prescaler on the fly to reduce the instruction rate of the chip. In my applications when the PIC was waiting for a serial command, I switched to a 16X prescaler which dropped the instruction rate from 30MIPS to approx. 1.8 MIPS and significantly dropped power consumption and temperature. When you do this though, you have to use different values in the baud rate generators to maintain your serial port speed.

From what I can determine, the dsPIC is capable of even higher MIPS so long as you keep the chip cool. Overall performance seems to be temperature limited, not silicon limited.

For your acquisition problem, I'm really not sure how the integrated ADC will handle a very small input while using small references. In my applications I haven't used the internal ADC but instead used an external highspeed 24-bit converter. If it does work, you would certainly have to spend a bit of money to get precision references and odds are you will have to use an amplifier anyway to match the impedance of the input. If you try it out and it works well, let us know!
 
mramos1,

If you buy the dsPICdem.net board from Microchip, it will come with everything you need and the PIC will already have a demo webserver running on the PIC.

Since I don't want to spend the money on the board and I don't need all of it's features, in the near future I'm going to make my own board using the dsPIC30F6014A and the Realtec ethernet controller along with the extra hardware I want.

The TCP/IP stack is very modular you can use any interface hardware you like. All you have to do is adapt the MAC.C file in the stack to use that hardware. I don't know as much as I would like about ethernet and it's protocols so I intend to take my time and learn as much about the nitty gritty as possible.
 
phalanx said:
Oz, the fractional type is actually prety easy and is explained in the dsPIC Family Reference Manual starting in section 2.6.1 (page 40 of the PDF). Breaking down the binary integer 0b0101, you get: 0^3+2^2+0^1+2^0 = 5. The fractional type breakdown looks like this: (first bit is the sign 0=+) 2^-1+0^-2+2^-3 = 0.625
Ok, that sounds simple enough! Now how do you state this in C30? Would you say:
fractional myF=0.625;
or declare it as
fractional myF=0.625f; //so the right hand side is read to be a float, but then converted at compile time?

phalanx said:
For your acquisition problem, I'm really not sure how the integrated ADC will handle a very small input while using small references. In my applications I haven't used the internal ADC but instead used an external highspeed 24-bit converter. If it does work, you would certainly have to spend a bit of money to get precision references and odds are you will have to use an amplifier anyway to match the impedance of the input. If you try it out and it works well, let us know!
Well it's an AC signal that will be 4KHz filtered and cap coupled to a bias of Vdd/2. I'm thinking a divider could be used to provide a Vref+/- of Vdd/2 +/- 50mV or so. The NoiseSupp algorithm is described as removing all components below I believe 80Hz and this includes a DC bias. So any DC bias error should be irrelevant. Also fortunate would be that if the input IS noisy and injects a white noise hiss into the audio range then the NoiseSupp algorithm should conveniently wipe it clean again. My main concern is if there's a nonlinearity or quanitization error then it could cause distortion that can't be fixed.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top