2017-12-06 09:06 AM
Hello,
I'm using STM32cubemx and I have created a project using UART in 9-bit configuration. The code is generated and I can find the 'HAL_UART_Transmit' function but the pData parameter is a 8-bit pointer:
HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout)
pData should be a 16-bit parameter. I cannot understand how can I send a 9-bit data with this function. Is it a bug in STM32CubeMX?
Thanks
IBRA
Solved! Go to Solution.
2017-12-06 01:43 PM
No, the byte array is just a universal solution. A 9-bit value is going to be spread over two bytes, low order bits in the first, or just use a 16-bit array and CAST it. The transfer count is in units, to send two 9-bit words, Size = 2
uint16_t x[2] = (0x123,0x091};
HAL_UART_Transmit(huart, (uint8_t *)x, 2, 1000);
2017-12-06 01:43 PM
No, the byte array is just a universal solution. A 9-bit value is going to be spread over two bytes, low order bits in the first, or just use a 16-bit array and CAST it. The transfer count is in units, to send two 9-bit words, Size = 2
uint16_t x[2] = (0x123,0x091};
HAL_UART_Transmit(huart, (uint8_t *)x, 2, 1000);
2017-12-07 03:39 AM
Clive,
I test successfully this solution
Thank you for your help.
IBRA