cancel
Showing results for 
Search instead for 
Did you mean: 

Generated LIN break is too short

FRieb.1
Associate III

Hi everybody,

I am using STM32G070KB and trying to generate a LIN break. But this seems to be only 10 bits long instead of the described 13 bits.

If I am right the break should be about 680µs long at 19.2kBaud. But it is only about 520µs long which is only 10 bits.

I may have configured the USART incorrectly. I trigger the break with:

USART1->RQR |= (USART_RQR_SBKRQ);

Configuration:

void UART_Init(void)
{
    UART1_CLK_EN();                                    /* UART3 Clock einschalten */
 
   USART1->CR1 = 0x00000000;                                    /* UART3 Konfiguration zurücksetzen */
    USART1->CR2 = 0x00000000;
    USART1->CR3 = 0x00000000;
 
   USART1->BRR = 16000000u / BAUDRATE_KLINE;                    /* Baudrate auf 19200 setzen */
 
   USART1->CR1 |= (USART_CR1_TE | USART_CR1_RE | USART_CR1_RXNEIE_RXFNEIE);   /* TX und RX einschalten, RX Interrupt einschalten */
 
   USART1->CR2 |= (USART_CR2_LINEN);
 
   USART1->CR3 |= (USART_CR3_ONEBIT | USART_CR3_EIE | USART_CR3_DMAT); /* One Sample Bit Mode, Error Interrupts, DMA Transmitter einschalten */
 
   RCC->AHBENR |= RCC_AHBENR_DMA1EN;                    /* DMA clock einschalten */
 
   DMA1_Channel2->CCR = 0x00000000;                    /* DMA Konfiguration zurücksetzen */
 
   DMA1_Channel2->CCR |= (DMA_CCR_MINC | DMA_CCR_DIR | DMA_CCR_TCIE);  /* Speicheradresse inkrementieren | Von Memory zu Peripherie | Transfer Complete Interrupt aktivieren */
 
   DMAMUX1_Channel1->CCR &= ~(DMAMUX_CxCR_DMAREQ_ID);
    DMAMUX1_Channel1->CCR |= (DMAMUX_CxCR_DMAREQ_ID_51);
 
   DMA1_Channel2->CPAR = (unsigned int)&USART1->TDR;            /* DMA-Ziel -> UART1 */
 
   DMA1_Channel2->CMAR = (unsigned int)UART_TX_Buffer;            /* Lese Daten aus UART_TX_Buffer */
 
   NVIC_SetPriority(USART1_IRQn, 3);                       /* Interruptpriorität für UART 1 setzen */
    NVIC_EnableIRQ(USART1_IRQn);                            /* Interrupts für UART 1 aktivieren */
 
   NVIC_SetPriority(DMA1_Channel2_3_IRQn, 3);                /* Interruptpriorität für DMA-Kanal 2-3 setzen */
    NVIC_EnableIRQ(DMA1_Channel2_3_IRQn);                    /* Interrupts für DMA-Kanal 2-3 aktivieren */
}

Thanks for the help.

0 REPLIES 0