Author Topic: PIC32 SCH advice. USB power filtering and SPI flash correct?  (Read 1679 times)

0 Members and 1 Guest are viewing this topic.

Offline pratiken

  • Contributor
  • Posts: 27
  • Country: us
  • Country: us
PIC32 SCH advice. USB power filtering and SPI flash correct?
« on: December 26, 2015, 01:43:50 am »
Hey guys, ME here new to PIC32 design.
 
I'm trying to design a little USB control board with a PIC32MX795F512H and I am wondering if I did a couple of things right.
This device will be powered by a 5V USB port. I tried to follow the starter kit reference design as best as I could.

1. For the USB wiring, the TPS2061 serves as power filtering, right? What are the FLT and EN lines really used for? The reference design hooks them up to pins on the PIC. I did that with the FLT, but am I supposed to use an IO pin for the EN pin too? I used a 5V->3.3V voltage regulator. Did I use that correctly?
 
2. SPI FLASH: I just copied the "typical application" schematic from the datasheet and hooked it up to the SPI lines on the PIC32. Am I okay there?
 
Thanks for any advice you guys can provide. This is all new to me but I'm trying to learn it.
 
I use the free Digikey schematic design tool thing, so here's the link to my schematic so far:
http://www.digikey.com/schemeit/#2e78
 

Offline TiN

  • Super Contributor
  • ***
  • Posts: 4011
  • Country: tw
  • Country: tw
  • xDevs.com/live - 24/7 lab feed
    • xDevs.com
Re: PIC32 SCH advice. USB power filtering and SPI flash correct?
« Reply #1 on: December 26, 2015, 07:53:46 am »
I don't think you need R3,R4,R5 there.

TPS2061 is a switch, so you can turn USB power on/off by level on EN pin signal (enable).
So you will need to connect GPIO to EN, to allow MCU control USB power. Also you may want to drive VBUS MCU pin via resistor divider (to bring USB 5V down to 3.3V levels) so MCU can know if USB powered or not.

I'm not PIC user, but J1 looks like programming port for me, so you may want to check if pullup-pulldown resistors are needed there..
YouTube | Chat room | Live-cam | Have documentation to share? Upload here! No size limit, firmware dumps, photos.
 

Offline pratiken

  • Contributor
  • Posts: 27
  • Country: us
  • Country: us
Re: PIC32 SCH advice. USB power filtering and SPI flash correct?
« Reply #2 on: December 26, 2015, 11:37:31 pm »
Thanks Tin,
I've made some changes based on other advice.

I don't need a timed clock so I guess I don't need the 32kHz xtal. Removed that.
 
Does the 5V->3.3V regulator help in filtering the power line? I know that many 5V USB sources, even motherboard ports, are very noisy.
 
From what I understand, the PIC32 can execute firmware code off of external flash memory like the S25L. Am I right about that? For example, can I load a bootloader firmware onto the PIC32 which executes firmware stored on the SPI flash?
 
  • Following this advice, I made some changes.
  • Vss goes directly to GND and Vdd goes to Vcc (3.3V) on all appropriate pins on PIC32
  • Pin5 on programmer JTAG goes directly to MCLR on PIC
  • Read the datasheet better on the S25FL flash chip. There's a Quad bit mode. Can I use that? I attached the diagram from the datasheet. Do I just route each IO pin from the flash chip to free IO pins on the PIC?
  • Vbus from USB connector goes through a diode (DB24312). I found that on a similar schematic. Is that worth using? The parallel 0.1uF caps (C1-C6) are from the MCHP Starter Kit. Are those all necessary?
  • Added an LED on RD7. Pretty sure I got that right :-)

 
THANKS!!
« Last Edit: December 26, 2015, 11:44:21 pm by pratiken »
 

Offline jpmkm

  • Contributor
  • Posts: 20
  • Country: us
  • Country: us
Re: PIC32 SCH advice. USB power filtering and SPI flash correct?
« Reply #3 on: December 28, 2015, 02:19:30 am »
Be aware that the traditional pinout for the ICSP(not JTAG) header is reversed from what you have - MCLR should be pin *1*.  Your order is correct, but reversed from what a programmer would expect.  Not a big deal, but something to be aware of.

There should be a pullup resistor(usually 10K) from MCLR to Vdd.  The MCLR is the reset line for the PIC, and is active *low*.  If that line is left floating, you will have very erratic behavior.

You will also need a VCAP capacitor.  You might check the datasheet, but I don't think this is optional for this series.  It would also be a very good idea to have decoupling caps on all your Vdd lines on the PIC.  Looking at your schematic, it looks like that's basically what C1-C6 are.  On the PCB, though, you'd want these caps as close to the PIC as is reasonable.

Not sure about executing code off external flash - I've never used that feature.  Are you going that route because of the size of your code?
 

Online Monkeh

  • Super Contributor
  • ***
  • Posts: 5882
  • Country: gb
  • Country: gb
Re: PIC32 SCH advice. USB power filtering and SPI flash correct?
« Reply #4 on: December 28, 2015, 02:39:48 am »
Re-read pages 38 and 181 of the datasheet. You really don't want to connect VCap to ground. You also want to pay attention to the reset pin.

Vbus should probably not be tied high.
 

Offline BloodyCactus

  • Frequent Contributor
  • **
  • Posts: 477
  • Country: us
  • Country: us
    • Kråketær
Re: PIC32 SCH advice. USB power filtering and SPI flash correct?
« Reply #5 on: December 28, 2015, 06:28:40 pm »
I don't need a timed clock so I guess I don't need the 32kHz xtal. Removed that.

doesnt the usb need an external crystal, because the internal frc is not hooked to the usb pll? throw an 8mhz crystal on and no worries.


From what I understand, the PIC32 can execute firmware code off of external flash memory like the S25L. Am I right about that? For example, can I load a bootloader firmware onto the PIC32 which executes firmware stored on the SPI flash?
 

unless you wrote a new bootloader for it, no.  you cant execute FROM flash. you can mess around and execute from internal SRAM.

well I say no, its not easy thing, but its possible with some jiggery pokery to execute external code from ram,
see http://ww1.microchip.com/downloads/en/DeviceDoc/61115F.pdf but its not like hitting a checkbox in mplabx or something.

you'll need to mess with the pic32's ram address maps and change some registers etc. be aware the perhiperals all use fixed addresses and things..

-- Aussie living in the USA --
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf