Maker Pro
Maker Pro

interfacing 3.6v flash memory to PIC microcontroller

I've successfully been using a serial (SPI) EEPROM driven by the PIC microcontroller. As the memory chip is powered by 5v, the SPI control lines from the PIC are wired directly to the memory.

Now I want to use a much larger FLASH memory (4mb) which has a 3.6v supply. Presumably I can no longer simply wire the PIC data & clock outputs (0-5v) directly to the memory. Do I simply use a potential divider to drop the 5v PIC output down to 3.6v or less, or is there more to it than that? The chip I'm intending to use is an SST25VF032B, but the datasheet does not specify maximum input pin voltage!

Thanks.
 
Most PICs will run at 3.6V so the easy solution is to just drop it down or use a chip that runs at the voltage... If not the 'better' way to do it is to use a level shifter, the 4050 is commonly used for this... There are also several other way to do the level shift as well, just start Googling if you want alternatives...
 
Last edited:
I know this is waking up an old thread, but I thought I had this sorted. Unfortunately I've still got a big problem - ie. circuit doesn't work!

To recap, I'm trying to interface a 3.3v SST25VF032B FLASH memory with a 5v PIC using the SPI bus. Running the PIC at 3.3v isn't an option, so I need to do some level conversion.

The previous design used a 5v 25AA1024 memory, and it worked fine, so we know the code is good - the SST25VF032B uses the same instruction set, and as far as I can tell from the datasheet it's essentially driven the same way except that it's a 3.3v device.

Initially I tried using an ADG3304 level shifter, but it did not work at all because I don't think it could drive the memory inputs. I'm assuming the inputs must be TTL, but the memory datasheet doesn't actually specify, and the level shifter datasheed didn't say that it could only drive CMOS inputs either! Anyway, I then went back to the idea of using discrete FETS as per this application note. However, This doesn't work either because I suspect the signal rise time is too slow. If I compare my old design with the working 25AA1024, the rise time of the clock and data inputs is about 40nS whereas the rise time using the FET level shifters is 80nS. If I play around with the pullups on the 3.3v side I see big changes in the rise time. If I use 10K pullups, the rise time is ridiculously long and would clearly never work. The only way I can bring the rise time down to 80nS is to use 270Ohm pullups, which then means the memory has to sink excessive current!

It's as if there is a huge amount of input capacitance floating around, but the PCB design is solid because it works with smaller memory chip. I'm really struggling with this one and I would appreciate any suggestions.

Thanks, Neil.
 
Running the PIC at 3.3v isn't an option

Why not, it's he most straight forward solution, most PICs are perfectly stable at 3V, and the sister 'LF' chips are stable down to 2V usually... Even when running at these lower voltages they are still happy getting 5V on the digital input pins, so you have little worries there...

Why must or why do you insist on running the PIC at 5V?
 
Why must or why do you insist on running the PIC at 5V?

Because of 0-5v analogue inputs coming in from other devices, and the need for 5v referenced internal analogue channels. It would be too much of a re-design to be viable at this stage.

Neil.
 
Last edited:
Because of 0-5v analogue inputs coming in from other devices, and the need for 5v referenced internal analogue channels. It would be too much of a re-design to be viable at this stage.

Establish a second 0-5V reference and those analog inputs will function just fine in the 0-5 range even when the chip is running at 3V...

As for redesign, you are at a point where you have little choice but a redesign of part of it, aren't you? Why not choose the easy straight forward redesign that introduces less possible issues and doesn't require any extra components?

I still believe you are trying to go about this the hard way when there is a much easier solution that will offer better function and reliability...
 
As for redesign, you are at a point where you have little choice but a redesign of part of it, aren't you?

Yes, of course, but adding a few components to a relatively unpopulated part of the board is far less of a problem than having to add a high power 3.3v supply to run the PIC, and yet still retain the 5v supply for the USB & RS232 & CANbus transceivers etc. The power supply area of the board is already very dense, and there's insufficient real estate to add another power supply. The 3.3v supply that I have to run the memory is only an SOT23 regulator which takes up very little space and is placed right by the memory chip, so that wasn't a problem to squeeze in. The current PCB uses a full 5v supply plane as well as a ground plane, so it would be a major undertaking in PCB re-design.

The other thing we need to consider is that if we run the PIC at 3.3v we lose 30% speed according to the datasheet.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
There are some tricks involving a single mosfet that will do bidirectional level translation. The issue may be speed though.

I note that the datasheet does not mention 5V tolerant inputs, so you've got to assume they're not.

The level shifter is here (see page 10). The pullup resistors are only needed if the outputs are open collector (or open drain). You may be able to get away without them.
 
Well I'm going to part out, it's redundant at this time as you have already decided what you want to do...

On that note won't compromise any speed if you use an LF part or if you are not running the PIC at full speed to start with, and/or you might very well be able to find a pin for pin PIC that will run at a faster speed then you are currently using and thus even with a 30% cut (FYI this is a safety margin, most of the time the chip will still run find at the lower voltage it's just not guaranteed) If you are willing to populate a level shift IC or some additional level shifting circuity into the board I can't for the life of my understand why you can't populate another small 3.3 regulator or up the capacity of the existing one by simply relocating it to the area (the area you were planing to build the level shift circuit) if you need more room to put in a larger regulator, it's not like the PCI itself is all that power hungry, usually only a few 100mA at max when cranked up...

Since you bring up speed you also have to factor this in, if you are all that worried about speed you might experience issues with level shifting as well, as pointed out by Steve... At least when you are trying to do it on the cheap or avoiding specialty chips...
 

KrisBlueNZ

Sadly passed away in 2015
That NXP app note you cite, and the one Steve linked to, relate to I2C communication. I2C is a multi-drop bus and needs special handling to get multi-drop behaviour across different supply voltages. You said your Flash EEPROM is SPI; you don't need any special handling here, since all signals have a defined direction. So don't bother with the designs in that app note.

Although you don't need bidirectional level shifters, you do need some shifting upwards and some shifting downwards. Presumably you'll need select, clock and mosi (master out slave in) converted from 5V to 3.3V, and miso converted from 3.3V to 5V.

How are you communicating with the Flash EEPROM? Are you using a SPI module inside the PIC? What is the clock rate you're using?

The ADG3304 looks like it should work. I'm a little worried that the data sheet is still at revision 0 even though it's dated 2010, and it doesn't explain how the automatic bidirectional feature works. I'm also very worried that the data sheet does not specify output voltage levels or output currents. It's almost as if it uses the same technique as those app notes suggest, and therefore requires pullup resistors.

When you tried the ADG3304, what do you think the problem was? Can you post a diagram of how you connected it and what waveforms you saw when the micro was trying to communicate with the EEPROM?

BTW when you mentioned issues of rise times with different pullup resistor values, were you taking the oscilloscope's input capacitance into account? It's usually a lot higher than stray capacitance on the PCB and will affect your rise times and give you an inaccurate picture of what would be happening if the scope wasn't connected. A x10 probe has much less capacitance than a x1 probe.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
That NXP app note you cite, and the one Steve linked to, relate to I2C communication. I2C is a multi-drop bus and needs special handling to get multi-drop behaviour across different supply voltages. You said your Flash EEPROM is SPI; you don't need any special handling here, since all signals have a defined direction. So don't bother with the designs in that app note.

You're right, I was thinking I2C.

The circuit would work (with pullups), but is overkill.

The inputs of the uC are probably OK with the 3.3V logic high level, so the output from the 3.3V logic may be able to be fed directly to the input pin of the uC.

You may be able to get away with a simple resistive divider on the 5V logic being fed to the 3.3V logic.
 

KrisBlueNZ

Sadly passed away in 2015
Yes, all agreed Steve.

I should have explained those options in my post. I'm afraid I got distracted because I was thinking about the ADG3304 and trying to figure out what it was all about.

That SerialFlash device will run at up to 3.6V. Its outputs (only MOSI in this case, called "SO") pull to within 0.2V of its supply rail, i.e. 3.4V (or 3.1V if you run it at 3.3V). Depending on the input characteristics of your microcontroller, this may be guaranteed to be interpreted as a high level, or it may not. Check the MCU's data sheet.

Then you need to reduce the three control signals from 0V/5V at the micro to 0V/3.6V or 0V/3.3V at the SerialFlash. As Steve said, simple two-resistor voltage dividers may be all that's needed. The resistors need to be in the ratio 1.4:3.6 (for 3.6V supply to the SerialFlash) or 1.7:3.3 (for 3.3V supply). The total resistance affects the extra current drawn from the 5V rail, and the maximum speed.

You could start with a total resistance around 5k. Put the resistors close to the SerialFlash to minimise the effect of stray capacitance. You may need to reduce the resistance if the clock speed is too high and the stray capacitance and input capacitance cause too much delay or skew.

If this isn't a problem you can increase the resistance to reduce the amount of power wasted. If possible, while you're not accessing the SerialFlash, tri-state the MCU outputs or make sure they're low, to minimise wasted power.

You probably know all that already; I'm just covering all the bases.
 
Thanks for all the help, we'll get there in the end :)

When I tried the ADG3304 we got nothing whatsoever out of it, so looking back on it, I guess the datasheet omitted the fact that pullups were required! After doing some trawling the net, I found that I wasn't the only one who couldn't get this chip to work, so I suspect it contained nothing more than 4 FET's! You live and learn.

Anyway, using a simple divider on the downward side should work OK because we're only running the memory in the hundreds of KHz, but I would definitely need upwards translation because the PIC SDI is a schmitt input so needs 4v minimum.

The current board iteration has the discrete FET level conversion as per those app notes. I know it's overkill as I don't need bi-directional, but it was easy to do. When I measured the signals, the probe was on x10, but it's only a cheap Chinese thing branded 'Tenma', so who knows what the probe capacitance is? So you could well be right, the signals might not actually be as bad as they look. The next step is to try different FET's - BSN20 as suggested in the Phillips document. Maybe the FET's I'm using are not fast enough, but at the speeds we're switching I'd be surprised.

There is also one other option that we could investigate if all else fails - a 74LCX125 quad non-inverting buffer with 5v tolerant inputs and outputs. So I run the buffer at 3.6v, and for the upwards translation I can simply add a pullup to 5v on the output to the PIC SDI line. It will be cheap and simple, and no need for any significant re-design - 1 14-pin SOIC & 1 resistor :)

I'll let you know how it goes, and thanks again for your suggestion.
 
Top