[SDP-K1] Change Serial Baud rate on fly

21 Aug 2019

Hi all,

I'm using Mbed on SDP-K1 in order to send DMX512 frames through UART1.

During the process, I change the baud rate of the UART with the Serial::baud() function, between two data transmission. Unfortunately, it's looks like the baud rate change doesn't take effect.

Here's a section of the code I used to test baud rate change :

Code


    while(true) {
        
        DMX_serial.baud(80000);
        DMXWriteFrame(0);


        
        DMX_serial.baud(250000);
        DMXWriteFrame(START_FRAME);
        DMXWriteFrame(_data_dmx[0]);
        DMXWriteFrame(_data_dmx[1]);

        led2 = !led2;

        //DMXWriteFrame(a++);
        wait_ms(SLEEP_TIME);
    }

When I look the frames with a scope, all data are transferred with the 250000 baud rate.

Do you have any suggestion ?

Regards,

Valentin

02 Sep 2019

Hello Valentin,

Add some delay (wait_ms(xxx);) after baudrate change and it will work.

Regards, Pekka