Page 1 of 1

UART Interrupt. Porting from STM32 to ESP 32

Posted: Mon May 04, 2020 8:28 pm
by waterfox
Hi,
I'm in the progress of porting BACnet MSTP from STM32 to ESP32. (The STM32 is programmed by Steve Karg https://github.com/bacnet-stack/bacnet-stack).

Now I'm able to compile the Code with the IDF 4.1. And it kind of runs on the ESP32.
At the moment I'm struggling with the following part. Or with other words I think that's the reason why the ESP is not able to receive data.
For the STM32 it looks like this:

Code: Select all

void USART2_IRQHandler(void)
{
    uint8_t data_byte;

    if (USART_GetITStatus(USART2, USART_IT_RXNE) != RESET) {
        /* Read one byte from the receive data register */
        data_byte = USART_ReceiveData(USART2);
        (void)FIFO_Put(&Receive_Buffer, data_byte);
    }
}

I've tried to solve the Problem as follows:

Code: Select all

{
   uint8_t data_byte;
   uart_read_bytes(UART_NUM_1, &data_byte, 1, 100 / portTICK_RATE_MS); 
   (void)FIFO_Put(&Receive_Buffer, data_byte);
   }
I thought that uart_read_bytes already trigger an interrupt. But maybe that's not enough?
How do I trigger the Interrupt correct?
I also put both files I compared into the attachments.

If someone is more interested in helping me with the backnet-stack, here is my git where I have the actual build: https://github.com/waterfox207/bacnet-s ... esp32_mstp


hope that someone can help me. :-)

Re: UART Interrupt. Porting from STM32 to ESP 32

Posted: Tue May 05, 2020 7:30 am
by ESP_Sprite
It might be easier to remove the entire FIFO logic, as the ESP32 UART driver already integrates an interrupt handler and FIFO.

Re: UART Interrupt. Porting from STM32 to ESP 32

Posted: Wed May 06, 2020 5:45 pm
by waterfox
Thank you I will give this a try :-)

Re: UART Interrupt. Porting from STM32 to ESP 32

Posted: Tue Aug 01, 2023 5:07 pm
by FluxGS
How did your port turn out?
I have an up coming project that requires a BACnet RS485 MS/TP slave feature to report a temperature.

Re: UART Interrupt. Porting from STM32 to ESP 32

Posted: Wed Aug 02, 2023 6:12 am
by waterfox
I was never able to finish the port.