Looking for a driver code for ADE7753 chip

Status
Not open for further replies.

markdem

Member level 3
Joined
May 16, 2006
Messages
58
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,830
Hi All, I am tring to write a driver for a ADE7753, but having some MAJOR problems. When I do a read to register 0x3f, which should be chip revision, I only get zero. Reads from any other register is the same. I have checked my hardware about 100 times, but it all seems to be OK. I dont have a scope to check the OSC or the SPI clock.

I have serached on this forum, the CCS forum and google, but I cant seem to find any code.

Has anybody actualy used this chip, and if so, could you PLAESE post the driver code.

Thank you

Mark
 

ade7753 code

The interface is similar to most Analog chips with an SPI interface. You most likely misunderstood the protocol or implemented it incorrect. I suggest to single step the code and to check the sequence of all SPI related signals during a communication cycle starting with /CS falling edge. Did you notice, that /RESET input also resets the interface? Holding /RESET low could probably also cause the said behaviour.
 
Reactions: tamizi

    tamizi

    Points: 2
    Helpful Answer Positive Rating
ade7753 software driver

Hello again, got some spare time today, so i Built a Proteus model so I can use the logic analyser, as i dont have a real one. After finding some small problems, I have made the PIC send out what the ADE7753 is expecting, including the CS and CLK lines. I have also simulated the ADE7753 response, and it all looks good. However, when I try this in real hardware, it still does not work. The responce from the ADE is always 255.

The following is my code,

Code:
#include <18F4550.h>

#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN,NOBROWNOUT,NOMCLR
#use delay(clock=48000000)

#define AD7758_CS		PIN_A0
#define ADE_DOUT 		PIN_C7 
#define ADE_DIN 		PIN_B0 
#define ADE_CLK 		PIN_B1 

#include "LCD420.c"

int test = 0, i, count;
int ADE_OUT_DATA = 63;   //chip version register from datasheet

void main()
	{
		lcd_init();
		printf(lcd_putc,"Ready");
		output_high(AD7758_CS);

		delay_ms(1000);

		while(1)
			{
				ADE_OUT_DATA = 63;
				output_low(AD7758_CS);
				delay_us(1);

				for(i=1;i<=8;++i) 
					{ 
						output_high(ADE_CLK); 
						delay_us(1);
						output_bit(ADE_DOUT, shift_left(&ADE_OUT_DATA,1,0));
						delay_us(1);
						output_low(ADE_CLK); 
						delay_us(1);
					} 
				
				output_low(ADE_DOUT);
				delay_us(4);

				for(i=1;i<=8;++i) 
					{ 	
						output_high(ADE_CLK); 
						delay_us(1);
						shift_left(&test,1,input(ADE_DIN)); 
						output_low(ADE_CLK); 
						delay_us(1);
					} 
 
				output_high(AD7758_CS);
				
				lcd_gotoxy(1,1);							//data returned from ADE7753
				printf(lcd_putc,"Data = %U",test);
					
				lcd_gotoxy(1,2);							//Counter to show PIC is working								
				printf(lcd_putc,"%U",count);

				delay_ms(500);
	
				count++;

			}
	}

Can anyone see any problems that I have missed??

Thanks

Mark

Added after 1 hours 15 minutes:

One other thing I have just noticed, If I remove the ADE7753, is still get 255 as the return. I dont have to pull the SPI Lines down, do I?

Thanks again,

Mark
 

ade7753 proteus

I think, the read operation is correct so far. This means, you most likely have a hardware problem (unconnects, shorts, mixed up signals). I repeat my suggestion to single step the code and check the signals at ADE7753 for each bit cycle. With ADE removed, you get the response from floating ADE_DIN. It should be 0 when pulling it down.

BTW.: You named your input signal ADE_DIN. But this line must be connected to ADE DOUT pin!
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…