2 years, 3 months ago.  This question has been closed. Reason: Duplicate question

Unable to change the Serial Baud rate in the application and always defaults to baud of 9600 .

Attempting to change the Baud Rate to 115200 doesn't take effect as shown in the code below on NRF52840_DK. I have also attached the bin file built using the online compiler. This has always worked prior to mbed os 5.9 and doesn't seem to work past that version of mbed os. The code below was built against mbed os 5.10.4.

Test Baud Rate

#include "mbed.h"

int main(void)
{   
    //serial debug
    Serial*  m_pc = NULL;
    
    //set the default log level.
    m_pc = new Serial(USBTX, USBRX);
    m_pc->baud(115200);
    
    //since we are using P0_5 (RTS) and P0_7 (CTS) pins we need to disable it
    //so it can be used as MOSI and Chip select pins.
    m_pc->set_flow_control(SerialBase::Disabled);

    printf("BLE Application Version: %s\n","1.0");
    
    if(m_pc != NULL)
    {
        delete m_pc;
        m_pc = NULL;    
    }
}

/media/uploads/yogeshk/testserialbaudrate.nrf52840_dk.bin

Thanks, Yogesh

Question relating to:

The nRF52840 Development Kit is a single-board development kit for Bluetooth low energy, ANT, 802.15.4, and 2.4 GHz proprietary applications using the nRF52840 SoC.

1 Answer

2 years, 3 months ago.

Hi Yogesh,

We see that you are getting traction of this question on GitHub so we're going to close this as a duplicate. For those that are interested, please follow the thread here:

Regards,

Ralph, Team Mbed