|
From: sani_figs on 21 Jun 2008 01:59 Hi, I will connect my ADE7758(metering IC) to a Z8 Encore! MCU through SPI (4pins: SCK,MISO,MOSI,CS). My problem is, although the input and output voltage ratings of the two chips match(5-6Volts input and output), I feel that there should be some hardware in between, meaning, I should not DIRECTLY connect the SPI pins of the MCU to the pins of the other IC. Any help on this matter will be well appreciated. Thanks!
From: Dave on 21 Jun 2008 03:14 sani_figs wrote: > Hi, I will connect my ADE7758(metering IC) to a Z8 Encore! MCU through SPI > (4pins: SCK,MISO,MOSI,CS). My problem is, although the input and output > voltage ratings of the two chips match(5-6Volts input and output), I feel > that there should be some hardware in between, meaning, I should not > DIRECTLY connect the SPI pins of the MCU to the pins of the other IC. Any > help on this matter will be well appreciated. Thanks! 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
From: Frank Buss on 21 Jun 2008 03:49 sani_figs wrote: > Hi, I will connect my ADE7758(metering IC) to a Z8 Encore! MCU through SPI > (4pins: SCK,MISO,MOSI,CS). My problem is, although the input and output > voltage ratings of the two chips match(5-6Volts input and output), I feel > that there should be some hardware in between, meaning, I should not > DIRECTLY connect the SPI pins of the MCU to the pins of the other IC. Any > help on this matter will be well appreciated. Thanks! 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(a)frank-buss.de http://www.frank-buss.de, http://www.it4-systems.de
From: sani_figs on 21 Jun 2008 05:27 Hi, I tried connecting the pins directly and i tested it with a simple code which fetches a single byte of data. I am getting no response from the chip. Can this be due to the need of level translator? or maybe because I made wrong SPI settings? I set my CPOL to 0 and CPHA to 1, but I'm feeling that my SCLK freq is wrong also because I used the BRH and BRL (for baud rate) settings that was used in the sample code from zilog (controlling a DS1722 temp sensor). I can't make out the right settings for these parameters from the datasheet of the ADE7758. By the way, Im using a Z8F6421 MCU. Thanks!
From: Frank Buss on 21 Jun 2008 05:40
sani_figs wrote: > I tried connecting the pins directly and i tested it with a simple code > which fetches a single byte of data. I am getting no response from the > chip. Can this be due to the need of level translator? 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. > or maybe because I > made wrong SPI settings? I set my CPOL to 0 and CPHA to 1, but I'm feeling > that my SCLK freq is wrong also because I used the BRH and BRL (for baud > rate) settings that was used in the sample code from zilog (controlling a > DS1722 temp sensor). I can't make out the right settings for these > parameters from the datasheet of the ADE7758. When I'm reading the datasheet for the ADE7758 (http://www.analog.com/UploadedFiles/Data_Sheets/ADE7758.pdf), 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(a)frank-buss.de http://www.frank-buss.de, http://www.it4-systems.de |