Hi, Please may I ask for assistance? I need a reliable method of interfacing an SPI SD/MMC card to a dsPIC. At the moment I'm using a 1k8/3k3 voltage divider on the 5v ----> 3.3v signals, and connecting the 3.3v ----> 5v signals straight to port. It's working ok upto about 3-5Mhz, with anything above 7.5Mhz causing misread bits. Here's the actual signals; dsPIC --------------- SD/MMC CLOCK (5v) ----> CLOCK (3.3v) SPI OUT (5v) ----> DATA IN (3.3v) CHIPSEL (5v) ----> CS (3.3v) SPI IN (5v) <---- DATA OUT (3.3v) Q1. Would it be an idea to reduce the values of R1/R2 in the voltage divider to achieve faster switching? Q2. Which commonly available ICs could perform this conversion at as much as 25Mhz? It has also occured to me that the +5v signals of the dsPIC aren't actually +5v. They're about 4.5v or thereabouts, making the 5v/3.3v divider kick out about 3v on the dot. The 5v rail is generated by a 7805 regulator with some smoothing. The 3.3v rail is generated by a 150mA TS2950CT-3.3. While experimenting and trying out different things before posting here, I have used 5k pots for the voltage dividers. If I increase the output voltage then reliability increases, I can operate at 7.5Mhz. I have here about 5 different SD cards of different sizes and from various manufacturers. Q3. Which is the final and most reliable method I can use to interface between 5v and 3.3v? Reliability is more important than cost. This is a low run item of about 100-200 units. With thanks, Alison
3.3v <> 5v interfacing @ 15Mhz
Started by ●November 25, 2006
Reply by ●November 25, 20062006-11-25
Alison wrote:> Hi, > > Please may I ask for assistance? I need a reliable method of interfacing an > SPI SD/MMC card to a dsPIC. At the moment I'm using a 1k8/3k3 voltage > divider on the 5v ----> 3.3v signals, and connecting the 3.3v ----> 5v > signals straight to port. > > It's working ok upto about 3-5Mhz, with anything above 7.5Mhz causing > misread bits. Here's the actual signals; > > dsPIC --------------- SD/MMC > CLOCK (5v) ----> CLOCK (3.3v) > SPI OUT (5v) ----> DATA IN (3.3v) > CHIPSEL (5v) ----> CS (3.3v) > SPI IN (5v) <---- DATA OUT (3.3v) > > Q1. Would it be an idea to reduce the values of R1/R2 in the voltage divider > to achieve faster switching? > Q2. Which commonly available ICs could perform this conversion at as much as > 25Mhz? > > It has also occured to me that the +5v signals of the dsPIC aren't actually > +5v. They're about 4.5v or thereabouts, making the 5v/3.3v divider kick out > about 3v on the dot. > > The 5v rail is generated by a 7805 regulator with some smoothing. The 3.3v > rail is generated by a 150mA TS2950CT-3.3. > > While experimenting and trying out different things before posting here, I > have used 5k pots for the voltage dividers. If I increase the output > voltage then reliability increases, I can operate at 7.5Mhz. > > I have here about 5 different SD cards of different sizes and from various > manufacturers. > > Q3. Which is the final and most reliable method I can use to interface > between 5v and 3.3v? > > Reliability is more important than cost. This is a low run item of about > 100-200 units. > > With thanks, > > Alisonx-posted to s.e.d. where you are likely to get answers. The divider you have should work fine at those speeds, with the caveat of track length and signal capacitance. Have you looked at the signals with a scope (using a 10x probe)? If you use buffering, simply get 3.3V devices with 5V tolerant inputs (all the usual suspects make them) or use transmission gates for the path from the processor to the MMC/SD card. I am using some TI devices in an SDIO implementation but that's because I have bidirectional data lines. As to the Card -> processor lines, and without looking at the DSPic datasheet, what is the Vih spec for the DSPic inputs? If they are true CMOS, then 3.3V is at the lowest Vih (2/3 Vcc). If they _are_ CMOS, then you'll need to translate those as well - use a 5V device with TTL level inputs. Cheers PeteS
Reply by ●November 25, 20062006-11-25
Alison wrote:> > Please may I ask for assistance? I need a reliable method of > interfacing an SPI SD/MMC card to a dsPIC. At the moment I'm > using a 1k8/3k3 voltage divider on the 5v ----> 3.3v signals, > and connecting the 3.3v ----> 5v signals straight to port. > > It's working ok upto about 3-5Mhz, with anything above 7.5Mhz > causing misread bits. Here's the actual signals;You have effectively supplied 3.3 V through about 1k. The chip uses more current as the frequency increases, thus dropping the supply voltage. You would be better off using an emitter follower to supply the current, driving it from that divider with a diode added for Vbe and thermal compensation. -- Chuck F (cbfalconer at maineline dot net) Available for consulting/temporary embedded and systems. <http://cbfalconer.home.att.net>
Reply by ●November 25, 20062006-11-25
You don't say exactly where you are putting the resistors. They should work fine in the paths that are inputs to the 3 volt SD card. But when you are driving out from the 3 volt SD card to the5 volt PIC, the resistors won't boost your voltage up! You should be able to drive the PIC directly from the SD card DATA OUT without resistors. Your problem is not speed per se, but rather voltage level. I have never figured out exactly what is going on in most CMOS interfaces. They often spec them like they are TTL when they are really symetrical CMOS. To see if your design will work without buffers you need to check the input and output voltage levels on the two devices and see if they are compatible. Even if you can get it to work on your bench, if you have too little noise margin it can fail in the field when the temperature changes or the PSU ages and the supply voltage changes. I took a look at the dsPIC33F and it uses CMOS input specs of 0.2/0.8 x Vdd, but TTL output specs of 0.4/2.4 volts. Their input and output specs are not compatible with itself! With a 5 volt supply the input high threshold is 4 volts, so you don't have a hope of meeting this with a 3.3 device. You will need 5 volt buffers with TTL level input voltages. It also says this part uses a 3.3 volt only supply. So something is rotten in Denmark. Why are you using 5 volts on the dsPIC in the first place? I see that the dsPIC30 will work up to 5 volts. Why not use a 3.3 volt part instead? Alison wrote:> Hi, > > Please may I ask for assistance? I need a reliable method of interfacing an > SPI SD/MMC card to a dsPIC. At the moment I'm using a 1k8/3k3 voltage > divider on the 5v ----> 3.3v signals, and connecting the 3.3v ----> 5v > signals straight to port. > > It's working ok upto about 3-5Mhz, with anything above 7.5Mhz causing > misread bits. Here's the actual signals; > > dsPIC --------------- SD/MMC > CLOCK (5v) ----> CLOCK (3.3v) > SPI OUT (5v) ----> DATA IN (3.3v) > CHIPSEL (5v) ----> CS (3.3v) > SPI IN (5v) <---- DATA OUT (3.3v) > > Q1. Would it be an idea to reduce the values of R1/R2 in the voltage divider > to achieve faster switching? > Q2. Which commonly available ICs could perform this conversion at as much as > 25Mhz? > > It has also occured to me that the +5v signals of the dsPIC aren't actually > +5v. They're about 4.5v or thereabouts, making the 5v/3.3v divider kick out > about 3v on the dot. > > The 5v rail is generated by a 7805 regulator with some smoothing. The 3.3v > rail is generated by a 150mA TS2950CT-3.3. > > While experimenting and trying out different things before posting here, I > have used 5k pots for the voltage dividers. If I increase the output > voltage then reliability increases, I can operate at 7.5Mhz. > > I have here about 5 different SD cards of different sizes and from various > manufacturers. > > Q3. Which is the final and most reliable method I can use to interface > between 5v and 3.3v? > > Reliability is more important than cost. This is a low run item of about > 100-200 units. > > With thanks, > > Alison
Reply by ●November 25, 20062006-11-25
PeteS <PeterSmith1954@googlemail.com> wrote in message news:1164460050.680279.8410@l39g2000cwd.googlegroups.com...>Hi Pete, thanks for your reply> x-posted to s.e.d. where you are likely to get answers. > > The divider you have should work fine at those speeds, with the caveat > of track length and signal capacitance. Have you looked at the signals > with a scope (using a 10x probe)?I'll try to get the scope back this weekend. I've been using a logic analyser for almost everything in this project.> If you use buffering, simply get 3.3V devices with 5V tolerant inputs > (all the usual suspects make them) or use transmission gates for the > path from the processor to the MMC/SD card. I am using some TI devices > in an SDIO implementation but that's because I have bidirectional data > lines.Nods> > As to the Card -> processor lines, and without looking at the DSPic > datasheet, what is the Vih spec for the DSPic inputs? If they are true > CMOS, then 3.3V is at the lowest Vih (2/3 Vcc). If they _are_ CMOS, > then you'll need to translate those as well - use a 5V device with TTL > level inputs.The ports are ST: Schmitt Trigger input with CMOS levels. ViH is... 0.8v So it should be fine. But.. I have a 100 Ohm resistor on the 3.3v DATA OUT line which connects in series to the dsPIC input port. If I do not do this then communication becomes even more unreliable. Most of the diagrams on the net do not have any kind of buffering on this line. I added it as a guess. My plan of action today is to build a piggyback board to go inbetween the dsPIC and main breadboard. The purpose of this is to reduce the uncertainty as much as possible. The SD card will be within about 1cm of the dsPIC rather than about 10cm away as at present on the end of solid signal wire. Does that sound like a likely culprit? Breadboards have always been fine here for low Mhz kit prior to getting them onto PCBs, and this is the first time I've really pushed passed about 5Mhz in a design. The SD card has to be as close as directly possible to the dsPIC to maintain reliability at high Mhz?> Cheers > > PeteS >no, thank you.
Reply by ●November 25, 20062006-11-25
rickman <gnuarm@gmail.com> wrote in message news:1164465685.740903.229950@j72g2000cwa.googlegroups.com... Hi Rickman,> You don't say exactly where you are putting the resistors.As per this diagram here; http://www.captain.at/electronics/pic-mmc/ This is further information on the interfacing; http://www.k9spud.com/sdcard/> They should > work fine in the paths that are inputs to the 3 volt SD card. But when > you are driving out from the 3 volt SD card to the5 volt PIC, the > resistors won't boost your voltage up! You should be able to drive the > PIC directly from the SD card DATA OUT without resistors. Your problem > is not speed per se, but rather voltage level.I'm not trying to boost the voltages up. It works fine upto about 7Mhz. I'm wondering if it would be *better* to use a specific IC 3.3v/5v bus transceiver when running at upto 25Mhz. If I don't buffer the 3.3v to 5v line then the errors increase. All of the Microchip documents and examples on the net 3.3v to 5v lines are connected directly.> I have never figured out exactly what is going on in most CMOS > interfaces. They often spec them like they are TTL when they are > really symetrical CMOS. To see if your design will work without > buffers you need to check the input and output voltage levels on the > two devices and see if they are compatible. Even if you can get it to > work on your bench, if you have too little noise margin it can fail in > the field when the temperature changes or the PSU ages and the supply > voltage changes. > > I took a look at the dsPIC33F and it uses CMOS input specs of 0.2/0.8 x > Vdd, but TTL output specs of 0.4/2.4 volts. Their input and output > specs are not compatible with itself! With a 5 volt supply the input > high threshold is 4 volts, so you don't have a hope of meeting this > with a 3.3 device. You will need 5 volt buffers with TTL level input > voltages.The ViH is 0.8v.> It also says this part uses a 3.3 volt only supply. So something is > rotten in Denmark. Why are you using 5 volts on the dsPIC in the first > place?It is indeed a 5v device. I see that the dsPIC30 will work up to 5 volts. Why not use a> 3.3 volt part instead?The 3.3v parts won't run upto 30/40MIPS which defeats the object of a dsp. It is interfacing to a 68000 DMA processor bus with rise times of about 15nS so I have to have the MIPS. That is a 5v TTL bus. So given that there's 30 data lines there, and only 4 on the SD card, it's clear which one gets converted. That side of the bridge has been completed and is working.
Reply by ●November 25, 20062006-11-25
Level shifters may do the trick http://www.standardics.nxp.com/products/levelshifters/ http://www.standardics.nxp.com/products/gtl/voltageclamps/ http://www.standardics.nxp.com/support/documents/logic/pdf/an10156.pdf http://www.standardics.nxp.com/support/documents/logic/pdf/an10145.pdf "Alison" <alison@logicsaysNOSPAM.com> wrote in message news:xLGdnSljmrnHy_XYRVnysQ@bt.com...> PeteS <PeterSmith1954@googlemail.com> wrote in message > news:1164460050.680279.8410@l39g2000cwd.googlegroups.com... >> > > Hi Pete, thanks for your reply > >> x-posted to s.e.d. where you are likely to get answers. >> >> The divider you have should work fine at those speeds, with the caveat >> of track length and signal capacitance. Have you looked at the signals >> with a scope (using a 10x probe)? > > I'll try to get the scope back this weekend. I've been using a logic > analyser for almost everything in this project. > >> If you use buffering, simply get 3.3V devices with 5V tolerant inputs >> (all the usual suspects make them) or use transmission gates for the >> path from the processor to the MMC/SD card. I am using some TI devices >> in an SDIO implementation but that's because I have bidirectional data >> lines. > > Nods > >> >> As to the Card -> processor lines, and without looking at the DSPic >> datasheet, what is the Vih spec for the DSPic inputs? If they are true >> CMOS, then 3.3V is at the lowest Vih (2/3 Vcc). If they _are_ CMOS, >> then you'll need to translate those as well - use a 5V device with TTL >> level inputs. > > The ports are ST: Schmitt Trigger input with CMOS levels. ViH is... 0.8v > > So it should be fine. But.. I have a 100 Ohm resistor on the 3.3v DATA > OUT > line which connects in series to the dsPIC input port. If I do not do > this > then communication becomes even more unreliable. Most of the diagrams on > the net do not have any kind of buffering on this line. I added it as a > guess. > > My plan of action today is to build a piggyback board to go inbetween the > dsPIC and main breadboard. The purpose of this is to reduce the > uncertainty > as much as possible. The SD card will be within about 1cm of the dsPIC > rather than about 10cm away as at present on the end of solid signal wire. > > Does that sound like a likely culprit? Breadboards have always been fine > here for low Mhz kit prior to getting them onto PCBs, and this is the > first > time I've really pushed passed about 5Mhz in a design. The SD card has to > be as close as directly possible to the dsPIC to maintain reliability at > high Mhz? > >> Cheers >> >> PeteS >> > > no, thank you. > > > >
Reply by ●November 25, 20062006-11-25
Alison wrote:> Hi, > > Please may I ask for assistance? I need a reliable method of interfacing an > SPI SD/MMC card to a dsPIC. At the moment I'm using a 1k8/3k3 voltage > divider on the 5v ----> 3.3v signals, and connecting the 3.3v ----> 5v > signals straight to port. > > It's working ok upto about 3-5Mhz, with anything above 7.5Mhz causing > misread bits. Here's the actual signals; > > dsPIC --------------- SD/MMC > CLOCK (5v) ----> CLOCK (3.3v) > SPI OUT (5v) ----> DATA IN (3.3v) > CHIPSEL (5v) ----> CS (3.3v)SN74LVC04A @ 3.3Vcc Use two inverters in series as a 5V tolerant follower SN74LVC3G34 @ 3.3Vcc - three followers.> SPI IN (5v) <---- DATA OUT (3.3v)SN74AHCT1G125 @ 5Vcc - 3.3V input levels> Q1. Would it be an idea to reduce the values of R1/R2 in the voltage divider > to achieve faster switching?@ 25MHz - I doubt it.> Q2. Which commonly available ICs could perform this conversion at as much as > 25Mhz?See above. They are available from Digikey.> Q3. Which is the final and most reliable method I can use to interface > between 5v and 3.3v?Use an appropriate logic ICs for voltage translation.> Reliability is more important than cost. This is a low run item of about > 100-200 units.Then use the ICs I mentioned above. They will work up to 30+MHz and easily available from catalog suppliers like Digikey and Mouser. -- WBR, Yuriy. "Resistance is futile"
Reply by ●November 25, 20062006-11-25
Alison wrote:> rickman <gnuarm@gmail.com> wrote in message > news:1164465685.740903.229950@j72g2000cwa.googlegroups.com... > > Hi Rickman, > > > You don't say exactly where you are putting the resistors. > > As per this diagram here; http://www.captain.at/electronics/pic-mmc/ > > This is further information on the interfacing; > http://www.k9spud.com/sdcard/Ok, so you are dropping the 5 volt outputs from the PIC (not dsPIC from your diagram) to the SD card and running directly from the SD card to the PIC. In general, that should be ok. You will not see any problems from this approach if you voltage levels are ok, which I can't verify since there seems to be some confusion about which PIC you are using. Can you give an exact part number?> I'm not trying to boost the voltages up. It works fine upto about 7Mhz. > I'm wondering if it would be *better* to use a specific IC 3.3v/5v bus > transceiver when running at upto 25Mhz. > > If I don't buffer the 3.3v to 5v line then the errors increase. All of t=he> Microchip documents and examples on the net 3.3v to 5v lines are connected > directly.Typically, the input high voltage threshold is held to 2.4 volts which allows the parts to work with TTL and 3.3 volt CMOS. But in reality the parts are CMOS and the FETs have to be made assymetrical to do this. Often the inputs are left as CMOS inputs which are not compatible with TTL outputs. What is the static voltage on the DATA OUT from the SD card?> The ViH is 0.8v.Since I don't know which PIC you are using, I don't know what the ViH is, but I can assure you it is *NOT* 0.8 volts. That would be a realistic ViL perhaps.> > It also says this part uses a 3.3 volt only supply. So something is > > rotten in Denmark. Why are you using 5 volts on the dsPIC in the first > > place? > > It is indeed a 5v device.But which device? The data sheet on the dsPIC33F shows a 40 MIP rating at 3.3 volts. TABLE 26-1: OPERATING MIPS VS. VOLTAGE Max MIPS dsPIC33F DC5 3.0-3.6V -40=B0C to +85=B0C 40 Perhaps all you need to do is switch PIC devices?> I see that the dsPIC30 will work up to 5 volts. Why not use a > > 3.3 volt part instead? > > The 3.3v parts won't run upto 30/40MIPS which defeats the object of a dsp. > It is interfacing to a 68000 DMA processor bus with rise times of about 1=5nS> so I have to have the MIPS. That is a 5v TTL bus. So given that there's=30> data lines there, and only 4 on the SD card, it's clear which one gets > converted. That side of the bridge has been completed and is working.Ok, that is clear. But I don't think the issue is dropping the 5 volt signals to 3.3 volts. The resistors will do that just fine. I suggest that you focus on the voltage level of the signal from the 3.3 volt side to the 5 volt side. You will likely need a buffer here to provide the 4 volts required to drive a 5 volt CMOS input.
Reply by ●November 25, 20062006-11-25
Alison wrote:> PeteS <PeterSmith1954@googlemail.com> wrote in message > news:1164460050.680279.8410@l39g2000cwd.googlegroups.com... > > >Inline> Hi Pete, thanks for your reply > > > x-posted to s.e.d. where you are likely to get answers. > > > > The divider you have should work fine at those speeds, with the caveat > > of track length and signal capacitance. Have you looked at the signals > > with a scope (using a 10x probe)? > > I'll try to get the scope back this weekend. I've been using a logic > analyser for almost everything in this project.The limits of analysers is that they don't detect actual voltage levels, of course, beyond what they have been set up for as a switching threshold.> > > If you use buffering, simply get 3.3V devices with 5V tolerant inputs > > (all the usual suspects make them) or use transmission gates for the > > path from the processor to the MMC/SD card. I am using some TI devices > > in an SDIO implementation but that's because I have bidirectional data > > lines. > > Nods > > > > > As to the Card -> processor lines, and without looking at the DSPic > > datasheet, what is the Vih spec for the DSPic inputs? If they are true > > CMOS, then 3.3V is at the lowest Vih (2/3 Vcc). If they _are_ CMOS, > > then you'll need to translate those as well - use a 5V device with TTL > > level inputs. > > The ports are ST: Schmitt Trigger input with CMOS levels. ViH is... 0.8v >0.8V would be ViL (max), not ViH(min).> So it should be fine. But.. I have a 100 Ohm resistor on the 3.3v DATA OUT > line which connects in series to the dsPIC input port. If I do not do this > then communication becomes even more unreliable. Most of the diagrams on > the net do not have any kind of buffering on this line. I added it as a > guess.Which indicates ringing on the line without the resistor.> > My plan of action today is to build a piggyback board to go inbetween the > dsPIC and main breadboard. The purpose of this is to reduce the uncertainty > as much as possible. The SD card will be within about 1cm of the dsPIC > rather than about 10cm away as at present on the end of solid signal wire.10cm on breadboard might be ok if the wires are routed appropriately. As I note above, you seem to have ringing on the line. Try a 22 ohm series resistor - that's what I have apart from the 4k7 (mostly) pullups. A 10 - 22pF loading cap might help too, although you should not need it on a properly laid out PCB.> > Does that sound like a likely culprit? Breadboards have always been fine > here for low Mhz kit prior to getting them onto PCBs, and this is the first > time I've really pushed passed about 5Mhz in a design. The SD card has to > be as close as directly possible to the dsPIC to maintain reliability at > high Mhz?Once on a circuit board, 10cm is not a long way at 25MHz, but you should probably set the line impedance controlled and terminate at each end. Without looking at the datasheets I can't give any direct assistance (and as I have to make dinner shortly I don't have the time ;) Cheers PeteS> > > Cheers > > > > PeteS > > > > no, thank you.