cancel
Showing results for 
Search instead for 
Did you mean: 

i2c example stm32f103 data transfer format

thomas_mechielsen
Associate
Posted on March 20, 2015 at 10:01

Dear all,

I am new to stm32 and i am trying to make my stm32f103 nucleo communicate with an other stm32f within the cubef1 is a nice working example:I2C_TwoBoards_ComIT i have only 1 problem with this part of the code:

/* While the I2C in reception process, user can transmit data through ''aTxBuffer'' buffer */
uint8_t aTxBuffer[] = 
''I send this''
;
while
(HAL_I2C_Master_Transmit_DMA(&I2cHandle, (uint16_t)I2C_ADDRESS, (uint8_t*)aTxBuffer, TXBUFFERSIZE)!= HAL_OK)
{
/* Error_Handler() function is called when Timeout error occurs.
When Acknowledge failure occurs (Slave don't acknowledge its address)
Master restarts communication */
if
(HAL_I2C_GetError(&I2cHandle) != HAL_I2C_ERROR_AF)
{
Error_Handler();
}
}

however the only data you send over the i2c lines are text converted to binary, which means you cant send all sorts of bytes. is there a way to make the format of data I send to hexadecimal or decimal? #example #i2c #stm32f103
0 REPLIES 0