2024-10-24 10:19 PM - last edited on 2024-10-25 12:47 AM by Andrew Neil
I want to send data from my STM32 to another micro controller and I want to enable space parity, there is no setting to enable it, the only settings are none, odd and even. For space parity i want the parity bit to always be 0. I am using 9 bit UART including parity bit. I have tried to maintain even parity meaning the data has even number of 1s so even parity is 0 always but that doesn't help. I am using Barry terminal to check the transmitted data in that when parity is set even or none then only data is received, with space parity settings its not received. Is there any way in which i can ensure that the parity bit is 0 always and I get the data with space parity settings?
Any help is appreciated. Thanks.
2024-10-25 02:21 AM
That not very helpful. What are you transmitting? Can you transmit a character with timing info - say 0xA5
Where are you measuring? TX data pin?
Kind regards
Pedro
2024-10-25 02:42 AM
Hi, I am transmitting 0xA5 and it is measured on Tx pin of stm32. The usart settings are 9 bit and parity none.
USART_DATA[0] = 0xA5;
USART_DATA[1] = 0x1C;
in while:
HAL_UART_Transmit(&huart2, USART_DATA , 1, 500);
HAL_Delay(1000);
2024-10-25 02:43 AM - edited 2024-10-25 02:49 AM
looking at the last bit since the parity is none it should not be sending parity bit and since the 9th bit is 0, it should have read in space parity as well.
2024-10-25 04:07 AM
Hi,
That's better info. I think you are sending Mark parity. Set bit 8 in your data, and try that...
uint16_t uartdata[1];
uartdata[0] = 0x1A5;
HAL_UART_Transmit(&huart2, (const uint8_t*) &uartdata[0] , sizeof(uartdata[0]), 500);
....
Kind regards
Pedro