AnsweredAssumed Answered

KL25/26 receive from multiple UARTs 

Question asked by Michael Netshipise on Feb 10, 2016
Latest reply on Feb 10, 2016 by Michael Netshipise


I am trying to connect to 2 devices on UART0 and UART1.

I get this problem when I open both UART0 and UART1:

After opening first UART: I can read/write on first UART properly.

After opening second UART: I can read/write on  second UART, but i can only write to the first UART. trying to receive from the first UART blocks and crashes the application (eventually).


However, they both work correctly when only one of them is opened.


What do i need to do to receive from both UARTs properly?


I have my clocks setup like this.


    SIM->SOPT2 |= (uint32_t)SIM_SOPT2_UART0SRC(0x01); //0x4000000
    SIM->CLKDIV1 |= SIM_CLKDIV1_OUTDIV4(0x01);  //0x10000



UART0 is setup like this: using serial_api.h from mbed.

    serial_init(&_serial0, PTA2, PTA1);  //24, 23
    serial_irq_handler(&_serial0, serial0_irq_handler, &_serial0);
    serial_irq_set(&_serial0, RxIrq, TRUE);
    serial_baud(&_serial0, 57600);


UART1 is setup like this: (also using serial_api.h from mbed).

    serial_init(&_serial1, PTC4, PTC3);  //49, 46
    serial_irq_handler(&_serial1, serial1_irq_handler, &_serial1);
    serial_irq_set(&_serial1, RxIrq, TRUE);
    serial_baud(&_serial1, 57600);


Both UARTs are using a ringbuffer for in the ISR of receive.


Kind Regards,