This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2652R7: Send break via UART emulator (Sensor controller)

Part Number: CC2652R7

Hi,

I'm using sensor controller as UART Emulator and integrated it in my project based on BLE Peripheral example. I want to know how to send TX break using UART Emulator.

I have found the below reference where they mention how to send break using UART emulator. My baud rate is 9600 and want to send break before sending data. But below one is not working for me. Help me on this.

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/595455/rtos-launchxl-cc2640r2-sent-break-signal-via-uart

           scifUartSetBaudRate(9600);    

           scifUartTxPutChar(stBuff.data_buff[0]);

           scifWaitOnNbl(500);

           // Enable baud rate generation

           scifUartSetBaudRate(19200);            

           scifUartTxPutChars(&stBuff.data_buff[1], u8Length-1);

 

Regards,

Madhusudhan

  • Hi Madhusdhan,

    You could generate the break condition either by using the pin in GPIO mode or by sending a 0x0 value over a slower baudrate (as you suggest in your question).

    I tried to modify the UART emulator example from sensor controller studio to do as you suggested and it seems to work on my side.

    void taskFxn(UArg a0, UArg a1) {
    
        // Initialize the Sensor Controller
        scifOsalInit();
        scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
        scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);
        scifInit(&scifDriverSetup);
    
        // Start the UART emulator
        scifExecuteTasksOnceNbl(BV(SCIF_UART_EMULATOR_TASK_ID));
    
        // Enable baud rate generation
        // set slow baud rate for break generation
        scifUartSetBaudRate(9600);
    
        // Enable RX (10 idle bit periods required before enabling start bit detection)
        scifUartSetRxFifoThr(SCIF_UART_RX_FIFO_MAX_COUNT / 2);
        scifUartSetRxTimeout(10 * 2);
        scifUartSetRxEnableReqIdleCount(10 * 2);
        scifUartRxEnable(1);
    
        // Enable events (half full RX FIFO or 10 bit period timeout
        scifUartSetEventMask(BV_SCIF_UART_ALERT_RX_FIFO_ABOVE_THR | BV_SCIF_UART_ALERT_RX_BYTE_TIMEOUT);
    
        // ## send break event ##
        scifUartTxPutChar(0);
        scifWaitOnNbl(500);
    
        // finally set correct baud rate
        scifUartSetBaudRate(57600);
        
        // rest of example unchanged...

    and I can observe the break event with a logic analyzer:

    How are you using the break condition in your protocol? And what precisely is not working for you?

    Regards,

    Fausto

  • Hi,

    The baud rate I'm using is 9600. So to generate break, I sent 0 at 4800 baud. I also got framing error like in your case with my logic analyzer.  I want to know if there's any way to simulate a proper break, so that it shows as break in logic analyzer.

    Regards,

    Madhusudhan

  • Hi,

    I'm using a Saleae logic analyzer and as far as I know a framing error and a break condition are the same thing. The framing error / break condition can be used by other protocols, for example LIN, to signal a specific event in the transmission (https://stackoverflow.com/questions/37540293/what-does-break-mean-in-real-terms-while-using-a-uart). When setting the logic analyzer to decode LIN I can decode the break condition.

    So I believe you are generating a proper break, you might just be decoding with a basic async serial protocol in which a break is decoded as a framing error.

    Regards,

    Fausto