2018-07-14 11:38 AM
Hi,
Communication: I2C
Master: STM32F746NGH6
Slave: bq25895M
IDE: Eclipse Neon
Previously, I can read from and write to the slave using HAL_I2C_Mem_Read() and HAL_I2C_Mem_Write() with I2C communication.
After I program my flash using JFlashLite, my previous program did not work anymore. Particularly, the above methods return HALL_ERROR since NACK flag is set.
The weird thing is that I have tested if I can get I2C communication using putty, and there is a communication. It just isn't with my previous program.
I don't know why and how to fix this.
Any helps would be appreciated.
I have included the log from putty in case if its needed for the problem-solving process.
Test finished successfully. 2
I2C OK with battery charger.
DATA0 IS WRITTEN
DATA1 IS WRITTEN
DATA0 = 0X7F
DATA1 = 0X5
DATA2 = 0X31
DATA3 = 0XA
DATA4 = 0X20
DATA5 = 0X13
DATA6 = 0X82
DATA7 = 0X9D
DATA8 = 0X3
DATA9 = 0X44
DATA10 = 0X93
DATA11 = 0XC6
DATA12 = 0
DATA13 = 0X57
DATA14 = 0
DATA15 = 0
DATA16 = 0
DATA17 = 0XE1
DATA18 = 0
DATA19 = 0X3F
Thanks.
2018-07-14 12:35 PM
Going to be hard to troubleshoot remotely.
I'd assume it's unrelated to the JLink unless you can make a case for something in flash or option bytes interfering with things.
You need to scope the I2C pins and validate the signals and sequencing. The slave device must respond to it's address on the bus, so the lack of ACK signal indicates the slave is unresponsive. Make sure you have suitable pull ups on the SDA/SCL pins, and the address presents correctly. Check any address jumpers on the slave.