cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with the Frame Error flag of STM32G071 UART for DMX interface

SimonEMBERGER
Associate II

Hello everyone,

I am implementing a DMX interface on a STM32G071K8.

You will find information about DMX here: https://www.thedmxwiki.com/dmx_basics/dmx_timing

An UART interface is used to get DMX data.

• I am used to use the Frame Error detection flag as a “Break�? detection (BREAK is a low state of 88us minimum on the transmission line)

•Then I launch the DMA to get the full frame.

•The next frame error or the idle (frame error is more accurate for DMX) might be used as end of frame.

The break timing I have is 200us which should be more than enought to set the Frame error flag of the UART (set with 2 stop bytes and 250 000 baud)

In my code I make an IO toggle in order to see the signal synchronisation on an oscilloscope.

UART, Clock (default 16Mhz) and one test output IO are configured with STMCube.

I use the following interrupt function:

void USART3_4_LPUART1_IRQHandler(void){

     volatile static uint8_t uartData;

     if((USART3->ISR & USART_ISR_FE) == USART_ISR_FE){ 

               HAL_GPIO_TogglePin(OUT_TEST_GPIO_Port,OUT_TEST_Pin);

       }

       USART3->ICR |= (3<<1);

       USART3->ICR |= (4<<1);

       USART3->ICR |= (1<<1);

       uartData = USART3->RDR;    // clear data flag

}

The problem I have is I do not have a correct Frame Error detection.

A lot of true Frame Error (Break signal) are not detected by the stm32G071K8.

You will find attached a document which sum up my tests with screen shots of the results I have on my oscilloscope.

I havent found any information in the STM32G071K8 errata, neither on the web.

Has anyone experienced such an issue ? Could it be a hardware bug inside of the stm ?

I experienced the same issue with both UART3 and UART4 (I have'nt tried with UART1 and UART2)

Best regards

1 ACCEPTED SOLUTION

Accepted Solutions
SimonEMBERGER
Associate II

Thanks for this answer, I have bypassed the issue using another IO and a timer to detect the breack signal.

I will have a look at the code on your link.

I had checked my previous code in step by step, using direct register access, but I could not fine the issue. My guess is either the bug is before getting into the UART interrupt in the code, or it's an hardware issue.

View solution in original post

2 REPLIES 2
Piranha
Chief II

Don't use the broken bloatware and write your own code:

https://github.com/MaJerle/stm32-usart-uart-dma-rx-tx

SimonEMBERGER
Associate II

Thanks for this answer, I have bypassed the issue using another IO and a timer to detect the breack signal.

I will have a look at the code on your link.

I had checked my previous code in step by step, using direct register access, but I could not fine the issue. My guess is either the bug is before getting into the UART interrupt in the code, or it's an hardware issue.