cancel
Showing results for 
Search instead for 
Did you mean: 

Space Parity Setting on STM32L010RB

Purnima_wbe
Associate II

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.

13 REPLIES 13
PGump.1
Senior III

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

AI = Artificial Intelligence, NI = No Intelligence, RI = Real Intelligence.

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);

 

Purnima_wbe_1-1729849283630.png

 

 

 

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.

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

AI = Artificial Intelligence, NI = No Intelligence, RI = Real Intelligence.