cancel
Showing results for 
Search instead for 
Did you mean: 

i need a USART 10 Bit Word length, how to implement Driver for STM32L4xx series any suggestion.

CBand.1
Associate II
 
6 REPLIES 6

Why? What is the counterpart? What baudrate, at which system clock? Simplex/duplex? Any other requirements?

The general approach is timer-based bitbanging, potentially employing DMA. See AN4457.

JW

CBand.1
Associate II

JW Thanks.

we are communicating different slave devices for that we need 10bit configuration.

other side device has supports the 10 bit.

Requirements:

word length : 10 bit

Stop bits : 1 & 2 stop

polarity : TX & RX vice versa.

W Thanks.

we are communicating different slave devices for that we need 10bit configuration.

other side device has supports the 10 bit.

Requirements:

word length : 10 bit

Stop bits : 1 & 2 stop

polarity : TX & RX vice versa.

Piranha
Chief II

A dumb guess, but still... Maybe it means "word length" of 10 bits including the start and stop bits?

[start]-1 [DataBits]-10bit [StopBits]-1bit/2bits

Solve Tx and Rx separately, using two timers. Start with Tx, that's easier. Start at low baudrate, timer generating interrupts at the barrister rate, and in timer interrupt, toggle a pin as appropriate, shifting out the transmitted value plus the framing bits.

Rx is somewhat more complex - you have to start the timer at the startbit's falling edge, detect that either as external interrupt, or, better but constrained in pins choice, use timer input capture (there a bonus that there is an adjustable filter on it). Then again in the timer interrupt, read the Rx pin and shift in the value.

Should you need higher narrated than the interiors allow, you would need to employ DMA.

JW