Hardware before SPI interfacing

Hi, I will connect my ADE7758(metering IC) to a Z8 Encore! MCU through SP (4pins: SCK,MISO,MOSI,CS). My problem is, although the input and outpu voltage ratings of the two chips match(5-6Volts input and output), I fee that there should be some hardware in between, meaning, I should no DIRECTLY connect the SPI pins of the MCU to the pins of the other IC. An help on this matter will be well appreciated. Thanks!

Reply to
sani_figs
Loading thread data ...

If the SPI pins of each part are electrically compatible (6V ???), they get connected directly.

MCU ADE7758

SCLK SCLK CS CS MOSI DIN MISO DOUT

All you have to do then is mode the MCU to the correct clock phase and clock polarity for the ADE7758, select it, transfer the correct amount of data, and deselect it.

Dave

Reply to
Dave

6V looks more like absolute maximum ratings. But you can read the datasheets to see if it works: ADE7758 says for logic inputs it needs at least 2.4V for detecting high and no more than 0.8V for detecting low. It outputs at least 4V for high and max 0.4V for low. The Z8 ENCORE! F0830 has some 5V tolerant pins, low level output voltage is max 0.6V and for low level input voltage it is max 0.3*Vdd allowed. This is 0.99V for 3.3V=Vdd, so this works. But the high level output voltage is min 2.4V, which means for the worst case that it doesn't work. You should add level converters for the 3 outputs from the Z8 to the ADE7758, e.g. SN74LVC1T45 or SN74LVC8T245.
--
Frank Buss, fb@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
Reply to
Frank Buss

Hi, I tried connecting the pins directly and i tested it with a simple cod which fetches a single byte of data. I am getting no response from th chip. Can this be due to the need of level translator? or maybe because made wrong SPI settings? I set my CPOL to 0 and CPHA to 1, but I'm feelin that my SCLK freq is wrong also because I used the BRH and BRL (for bau rate) settings that was used in the sample code from zilog (controlling DS1722 temp sensor). I can't make out the right settings for thes parameters from the datasheet of the ADE7758. By the way, Im using Z8F6421 MCU. Thanks!

Reply to
sani_figs

No, it should work. You can measure the voltage. The level translator would be needed only for production, because the specification says 2.4V min output, which is the lower limit for detecting it as high level, too, so this is on the border, but I assume usually the output voltage is higher.

When I'm reading the datasheet for the ADE7758

formatting link
there are some nice timing diagrams on page 7. Compare this to the timing diagrams of the SPI module. If you have a scope, the easiest way would be to scope clock and data and compare it to the timing diagram of the ADE7758. You can try to implement a bitbanging function instead of using the SPI module of your CPU, to verify the connection and the commands for the ADE7758, then scope it, then compare it with the signals the SPI module generates.

BTW: there are other microcontrollers which are working with 5V supply voltage, if you want to save one voltage regulator.

--
Frank Buss, fb@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
Reply to
Frank Buss

What, if anything, is this about? If you want to post a followup via groups.google.com, ensure you quote enough for the article to make sense. Google is only an interface to Usenet; it's not Usenet itself. Don't assume your readers can, or ever will, see any previous articles.

More details at:

--
 [mail]: Chuck F (cbfalconer at maineline dot net) 
 [page]: 
            Try the download section.


** Posted from http://www.teranews.com **
Reply to
CBFalconer

A series resistor on the interconnecting lines will limit the current between two pins if, during startup or initialization, you inadvertently end up with two outputs fighting each other.

Generally (I'm sure there are exceptions) for microcontroller I/O pins, a power-on reset passes through a high impedance, off-bus state to a high impedance, input-port state. One typically has to explicitly configure a peripheral (e.g., SPI) to drive output pins, after the remote chip has finished its power-on routine and has settled down to the correct states.

However, you can add something like a 1K series resistor to the interconnecting lines as insurance at the cost of slowing down the edges on the transitions and reducing your maximum achievable SPI clock.

--
Rich Webb     Norfolk, VA
Reply to
Rich Webb

of

Thanks Sir Frank, I'll try looking at these timing diagrams since I have noted that whe reading data from the chip, there should be a 4us delay (t9 in the timin diagram) between the fetch command and the output of the data. Maybe I' missing that part in the code. I'll try implementing that delay. :)

Reply to
sani_figs

Frank Buss ha scritto:

uhm, Voh min 2.4V @ which current ? and on hiz load ?

regards

Reply to
lowcost

Are you pulling the CS low before performe any operation. to check your code, scope the SCLK pin and MOSI pin to see the frequency, polarity and phase.

Thanushan

Reply to
Thanushan

Yes, I'am setting the CS line to '0' before operations. I have not ye tried scoping the signals. I'll try it today. thanks.

regards,

Reply to
sani_figs

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.