Quantcast
Channel: Power management forum - Recent Threads
Viewing all articles
Browse latest Browse all 35901

Programming BQ27510-G3 with PIC33ep512mu810

$
0
0

Hallo E2E Community,

I am an electronics technician in education and I need some help.

First of all I use the PIC33ep512mu810 uC. The Program is coded on MPLAB.  

I want to monitor three Batteries parallel with three BQ27510-G3.

I tried to read the device type from the BQ27510-G3 but it doesn't work.

I measured the Bus with the oscilloscope and saw all acknowledge and not acknowledge on the right place.

But I still get no Data!

So I tried some different command arrangements.

Butt still nothing works.

I think it may be a definition, "command structure"  or schematic mistake.  

That' s the schematic:

And that's my implemented code to read the Device Type:

I2C1CONbits.SEN = 1; 

while(I2C1CONbits.SEN == 1);

 

while(I2C1STATbits .TRSTAT == 1);

I2C1TRN  = 0xAA;

while(I2C1STATbits .TRSTAT == 1);   

while(I2C1STATbits .TBF == 1);

 

while(I2C1STATbits .TRSTAT == 1);

I2C1TRN  = 0x00;

while(I2C1STATbits .TRSTAT == 1);   

while(I2C1STATbits .TBF == 1);

 

while(I2C1STATbits .TRSTAT == 1);

I2C1TRN  = 0x01;

while(I2C1STATbits .TRSTAT == 1);   

while(I2C1STATbits .TBF == 1);

 

while(I2C1STATbits .TRSTAT == 1);

I2C1TRN  = 0x00;

while(I2C1STATbits .TRSTAT == 1);   

while(I2C1STATbits .TBF == 1);

 

I2C1CONbits.PEN = 1;

while(I2C1CONbits.PEN);

 

I2C1CONbits.SEN = 1; 

while(I2C1CONbits.SEN == 1);

 

while(I2C1STATbits .TRSTAT == 1);

I2C1TRN  = 0xAA;

while(I2C1STATbits .TRSTAT == 1);   

while(I2C1STATbits .TBF == 1);

 

while(I2C1STATbits .TRSTAT == 1);

I2C1TRN  = 0x00;

while(I2C1STATbits .TRSTAT == 1);   

while(I2C1STATbits .TBF == 1);

 

I2C1CONbits.RSEN = 1;

while(I2C1CONbits.RSEN == 1);

 

while(I2C1STATbits .TRSTAT == 1);

I2C1TRN  = 0xAB;

while(I2C1STATbits .TRSTAT == 1);   

while(I2C1STATbits .TBF == 1);

 

I2C1CONbits.RCEN = 1;      

while(I2C1STATbits .RBF ==0);   

I2Cread1 = I2C2RCV;       

while(I2C1CONbits.RCEN ==1);

I2C1CONbits.ACKDT=0;

 

I2C1CONbits.RCEN = 1;      

while(I2C1STATbits .RBF ==0);   

I2Cread2 = I2C2RCV;       

while(I2C1CONbits.RCEN ==1);

I2C1CONbits.ACKDT=1;

 

I2C1CONbits.PEN = 1;

while(I2C1CONbits.PEN);

I can't see the mistake. 

Thanks for help:)


Viewing all articles
Browse latest Browse all 35901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>