Skip to main content
Yannek
Associate III
December 8, 2019
Solved

Detailed behaviour of LinFlex registers during transmission (UART mode)?

  • December 8, 2019
  • 3 replies
  • 1623 views

I am implementing UART transmission in SPC560B50L1. Due to modest description in manual, I have some detailed questions:

  1. I set UARTCR[TDFL]=3, set TXEN and fill BDRLs registers, starting transmission.

What is the exact moment when the DTF flag will be set? On which edge of which byte transmitted by UART?

2. Can I access (read or write) BDRL registers before DTF flag is set? How does modification of BDRL registers affect transmission?

3. Is it possible to interrupt pending transmission? Like in the middle of byte being transmitted.

This topic has been closed for replies.
Best answer by Giuseppe DI-GIORE

​Hello,

as reported by Reference Manual:

In order to start transmission in UART mode, you must program the UART bit and the transmitter enable (TXEN) bit in the UARTCR to 1. Transmission starts when DATA0 (least significant data byte) is programmed. The number of bytes transmitted is equal to the value configured by UARTCR[TDFL]

The Transmit buffer is 4 bytes, hence a 4-byte maximum transmission can be triggered. Once the programmed number of bytes has been transmitted, the UARTSR[DTF] bit is set. If UARTCR[TXEN] is reset during a transmission then the current transmission is completed and no further transmission can be invoked.

Specific to your questions:

  1. I set UARTCR[TDFL]=3, set TXEN and fill BDRLs registers, starting transmission.
  • What is the exact moment when the DTF flag will be set? On which edge of which byte transmitted by UART?

DTF is set on the last bit of the last byte.

  1. Can I access (read or write) BDRL registers before DTF flag is set? How does modification of BDRL registers affect transmission?

After starting the transmission BDLR registers are accessible, However transmission is unpredictable.

3. Is it possible to interrupt pending transmission? Like in the middle of byte being transmitted.

Transmission can be interrupted at any time by settgin UARTCR[TXEN] = 0

Regards,

Giuseppe

3 replies

Yannek
YannekAuthor
Associate III
December 17, 2019

Any help, please?

Giuseppe DI-GIORE
ST Employee
February 3, 2020

​Hello,

as reported by Reference Manual:

In order to start transmission in UART mode, you must program the UART bit and the transmitter enable (TXEN) bit in the UARTCR to 1. Transmission starts when DATA0 (least significant data byte) is programmed. The number of bytes transmitted is equal to the value configured by UARTCR[TDFL]

The Transmit buffer is 4 bytes, hence a 4-byte maximum transmission can be triggered. Once the programmed number of bytes has been transmitted, the UARTSR[DTF] bit is set. If UARTCR[TXEN] is reset during a transmission then the current transmission is completed and no further transmission can be invoked.

Specific to your questions:

  1. I set UARTCR[TDFL]=3, set TXEN and fill BDRLs registers, starting transmission.
  • What is the exact moment when the DTF flag will be set? On which edge of which byte transmitted by UART?

DTF is set on the last bit of the last byte.

  1. Can I access (read or write) BDRL registers before DTF flag is set? How does modification of BDRL registers affect transmission?

After starting the transmission BDLR registers are accessible, However transmission is unpredictable.

3. Is it possible to interrupt pending transmission? Like in the middle of byte being transmitted.

Transmission can be interrupted at any time by settgin UARTCR[TXEN] = 0

Regards,

Giuseppe

Yannek
YannekAuthor
Associate III
February 4, 2020

Thanks!