2023-05-23 09:10 AM
I am using a Flintec TR2 board, and I want to communicate with it via my STM32 L496zg Nucleo Board. It uses I2C repeated start condition to communicate. Most of the codes I found online suggest using HAL_I2C_Mem_Read/Write functions but the user manual does not have any register addresses mentioned in the manual.
Can someone guide me on this?
Solved! Go to Solution.
2023-05-26 02:23 AM
Hello @AVima.1 ,
"The TR2 will operate in 7-bit addressing mode with a slave address of 0x03.
All communication on the I2C bus is driven by the master ECU and thus operates in a
request/response format. The command set is broadly split into three command types: read
commands, write commands and execute commands"
So I suggest you use the HAL functions :
/* Transmits in master mode an amount of data in blocking mode */
HAL_I2C_Master_Transmit(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout)
/* Receives in master mode an amount of data in blocking mode */
HAL_I2C_Master_Receive(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout)
Foued
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-05-26 02:23 AM
Hello @AVima.1 ,
"The TR2 will operate in 7-bit addressing mode with a slave address of 0x03.
All communication on the I2C bus is driven by the master ECU and thus operates in a
request/response format. The command set is broadly split into three command types: read
commands, write commands and execute commands"
So I suggest you use the HAL functions :
/* Transmits in master mode an amount of data in blocking mode */
HAL_I2C_Master_Transmit(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout)
/* Receives in master mode an amount of data in blocking mode */
HAL_I2C_Master_Receive(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout)
Foued
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-05-26 01:45 PM
@AVima.1 In this case the command code and checksum (two bytes) stand for a 16-bit "memory address". So you can use HAL_I2C_Mem_Read for read and execute commands.