dsPIC33EP512MU814 config questions

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

dsPIC33EP512MU814 config questions

Post by hyperion007 »

Hi

I am going to be using the dsPIC33EP512MU814 chip for a couple of projects I have thought of but as I have never used dsPICs before and this seems to be the biggest and baddest of them all I thought it would suit my needs now and in the future.

However, I am having a bit of struggle getting to grips with all the config parameters. Especially when it comes to the Oscillator stuff.

I want to run this dsPIC at maximum speed which is 140Mhz (70MIPS) but it's not exactly as easy as sticking a 10Mhz crystal and a couple of capacitors between the OSC1 and OSC2 pins, setting 140Mhz as clock speed in FC and setting the 10Mhz value of the crystal in the configuration tab of FC and be done.

Now I have to start up the MCU using either an external primary crystal (or resonator) that is slower than 13.6Mhz (ie 10Mhz) with PLL, or a higher frequency crystal without PLL, then configure the PLL bits and then performing a clock switch.

My current plans does not require a super fast start up so I guess I could start using the FRC without PLL, configure PLL and clock settings to switch over to a external primary oscillator once that is done, using PLL lock. Not sure how I should do it in FC though.

All of my plans do however include a USB component and if I understand the datasheet correctly I will have to use a second oscillator for the 48Mhz USB clock source? Or I might be able to use the primary clock source together with the Aux PLL?

The Microchip Reference Guide for these dsPICs, section 7 - "Oscillator" has so much information that I get more new questions than answers to old ones after reading it several times.

I miss the simple times of PIC18F4550 and FC v5 where I could just choose HS+USB PLL, no div, etc etc :)

Right now I am working on a breadboard "friendly" PCB for this LQFP-144 chip so I need to get all the basics sorted out so I know what parts to use in the PCB design. The idea being that only the "usable" pins will be broken out to pin headers for the breadboard and have the rest on the PCB (power options(lipo,USB,3.3V,5.0V), decoupling caps, crystal(s)/resonator(s), ICSP header, USB connector, a couple of select-able LEDs for status indication and debugging etc.) This will minimize the number of pins that go to the breadboard and also the number of components on the breadboard thereby freeing up valuable space and making it easier to wire up the breadboard with other components. Also it will greatly increase the stability of the MCU when dealing with noisy components like LED PWM drivers etc, as well as reducing the noise produced by the MCU which is nice when working on audio projects etc.

The PCB design will be free to use and modify by anyone who wants to. I would love to get input, ideas, help etc. with this as I am in no way an expert at any of it :) I will offer to solder on the components for anyone who wants to play around with the biggest and most powerful dsPIC Microchip has to offer but don't have the ability to solder the 144 pin SMD chip and the small (0805) caps etc.

So, how would you go about the OSC configuration etc?

Let me know.

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: dsPIC33EP512MU814 config questions

Post by kersing »

hyperion007 wrote: I want to run this dsPIC at maximum speed which is 140Mhz (70MIPS) but it's not exactly as easy as sticking a 10Mhz crystal and a couple of capacitors between the OSC1 and OSC2 pins, setting 140Mhz as clock speed in FC and setting the 10Mhz value of the crystal in the configuration tab of FC and be done.
You will have to use C code to configure the clock.
hyperion007 wrote: Now I have to start up the MCU using either an external primary crystal (or resonator) that is slower than 13.6Mhz (ie 10Mhz) with PLL, or a higher frequency crystal without PLL, then configure the PLL bits and then performing a clock switch.
I would start with FRC and switch to HSPLL (you are not able to switch from FRCPLL to primary oscillator with PLL, see note 2 on page 182 of the device data sheet)
hyperion007 wrote: My current plans does not require a super fast start up so I guess I could start using the FRC without PLL, configure PLL and clock settings to switch over to a external primary oscillator once that is done, using PLL lock. Not sure how I should do it in FC though.
This will require a C icon as well at the moment.
hyperion007 wrote: All of my plans do however include a USB component and if I understand the datasheet correctly I will have to use a second oscillator for the 48Mhz USB clock source? Or I might be able to use the primary clock source together with the Aux PLL?
When using a 16MHz crystal for the clock you could use it to generate the USB frequency as well. Use ASRCSEL=1, APLLPRE=4 (011), APLLDIV=24 (111), APLLPOST=2 (110).
For the main settings use: PLLPRE=4 (00010), PLLDIV=70 (001000100), PLLPOST=2 (00)
hyperion007 wrote: as well as reducing the noise produced by the MCU which is nice when working on audio projects etc.
Make sure to use 'copper pour' to create as much ground as possible to reduce noise for audio purposes.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: dsPIC33EP512MU814 config questions

Post by hyperion007 »

Thanks!

I'll have a go with a 16Mhz resonator and keep going with the PCB. Will be using 4 layers to keep the board size down and minimize noise by having a full ground plane layer the top layer. The PCB design is what I feel most confident about :)

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: dsPIC33EP512MU814 config questions

Post by kersing »

hyperion007 wrote:All of my plans do however include a USB component ...
What I forgot to mention in my last message, the Flowcode USB components currently do not support these devices as far as I know! (Ben, correct me if I'm wrong)
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: dsPIC33EP512MU814 config questions

Post by hyperion007 »

Really?

That is not good news at all!

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: dsPIC33EP512MU814 config questions

Post by Benj »

Hello,

Should be easy to add these devices, I will investigate.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: dsPIC33EP512MU814 config questions

Post by Benj »

Hello,

I've found a few bugs for USB on the 16-bit PIC range, the 33EP512MU814 device should have been working but it looks like no USB is working for this range at the moment.

I think I've fixed all the problems now but going to do some testing to be sure and then all the fixes will be included in the next release.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: dsPIC33EP512MU814 config questions

Post by Benj »

In the mean time you can use the files here and they should allow a 16-bit PIC to compile with USB functionality.
Attachments
USB-Update.zip
(212.46 KiB) Downloaded 253 times

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: dsPIC33EP512MU814 config questions

Post by hyperion007 »

Thanks!

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: dsPIC33EP512MU814 config questions

Post by kersing »

Benj wrote:In the mean time you can use the files here and they should allow a 16-bit PIC to compile with USB functionality.
Just to be clear, USB Device functionality, not USB Host (from USB-OTG) I assume?
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: dsPIC33EP512MU814 config questions

Post by Benj »

Just to be clear, USB Device functionality, not USB Host (from USB-OTG) I assume?
Yep USB device only at the moment.

I want to roll out a better USB stack eventually which will allow OTG to work and also allow multiple enumerations e.g. CDC + MassStorage which would be very nice.

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: dsPIC33EP512MU814 config questions

Post by hyperion007 »

I would really like to see full support for all functions this device has to offer, especially everything that has to do with USB functions like OTG etc.
More settings under project configuration like clock switching etc might be a good idea maybe?

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: dsPIC33EP512MU814 config questions

Post by hyperion007 »

I'm resurrecting this old thread as I am starting to work on this project again.

Just want to make sure I get it right the first time regarding the crystal speed. Will a 16Mhz crystal enable me to use it for both the 48Mhz USB clock source and still allow me to run the MCU at it's maximum 70 MIPS?

Or would I be better off using another crystal speed?

Any news on the USB functions for this dsPIC on FC6? Any other fun updates for it function wise?


Thanks.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: dsPIC33EP512MU814 config questions

Post by Benj »

Hello,

I use an 8MHz crystal in my projects with this device and this also works for the Microchip demo USB bootloader so it works out the box for 70MIPs operation. 16MHz should also work but you will have to tweak the PLL and USB divider using a C icon or inside the bootloader firmware if your using the bootloader.

http://ww1.microchip.com/downloads/en/D ... loader.zip

Note that if you do use the bootloader then use MPLAB to load the hex file onto the device using a PICkit 3. Use the Programmer -> Settings menu item and ensure that auxiliary flash is enabled to allow the bootloader to actually get programmed in.

Microchip bootloader may default to 60MIPs operation speed so test this out with a 1 second flasher and I can provide a modified bootloader .hex file if necessary. Enter 140000000 as your clock speed in Flowcode and use the 1 sec flasher to confirm.

If you setup the clock speeds correctly then I think the Flowcode USB components should work fine. I need to double check this but I certainly have had USB working on these devices.

Post Reply