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.

CC2642R: Display_printf is not working

Part Number: CC2642R
Other Parts Discussed in Thread: SYSCONFIG

Hi everyone,

I'm using simple_peripheral_oad_offchip_CC26X2R1_LAUNCHXL_tirtos_ccs project.

How to use Display_printf to print something with UART

The code is:

Display_Handle dispHandle = NULL;

static void SimplePeripheral_init(void)
{
   GPIO_init();
   I2C_init();
   Display_init();
   
.
.
.

  Display_printf(dispHandle, 1, 0, "====================");
.
.
.
}

As following screenshot,  I am seeing random gibberish getting printed on the machine. 

  • Hi Lulu,

    What is your selected baud rate?  The default for SimpleLink SDK projects is 115200.  You should also make sure that you have the off-chip BIM hex image loaded alongside your simple peripheral OAD project binary image.  I would also caution using Display_printf since the simple peripheral example already uses the Display driver to display messages, as further explained in this README.

    Regards,
    Ryan

  • Hi Ryan,

    I selected baud rate is 115200. Could you recommend me another function to display messages?

  • I would first recommend that you get the terminal to show UART messages correctly from the simple peripheral example (without OAD, it should look like the README description provided) and understand how it displays messages.  Then you should incorporate Display_printf to utilize a column not already used by the example.  Check the definitions in simple_peripheral.c as SP_ROW_DEBUG is unused, or you can add your own to the end.  Once all of this is working properly, perform the same changes to an OAD-enabled example and follow the BLE Enhanced OAD SimpleLink Academy Lab to understand how it should be loaded properly.

    Regards,
    Ryan

  • Hi Ryan,

    Thank you for your suggestion. 

    I add a breakpoint that I found it stuck at Display_printf(dispHandle, 1, 0, "===================="); and show the warning "Description Resource Path Location Type #551-D variable "displayHandle" is used before its value is set".


    Thanks and regards,

  • You need to assign the display handle with the return from opening the display instance, i.e. dispHandle = Display_open(Display_Type_ANY, NULL);, and this occurs in SimplePeripheral_init.

    Regards,
    Ryan

  • Hi Ryan,
    I have used breakpoint to make sure that the code is working, but I don't see any message on the terminal.
    By the way, I used the PTM Mode. May it cause the problem?

    Thanks and regards,
  • Notes on PTM from SysConfig and the BLE5-Stack User's Guide:

    Production Test Mode (PTM), allows for an embedded software application to support direct test mode without exposing the HCI to the UART pins under normal operation.  Note: The pins used for PTM can also be used for an application UART interface. In this case, it is necessary to ensure that the other device that is connected to the UART interface does not run at the same time that DTM is being exercised. If the device powers up and goes into PTM mode (by a GPIO being held high or low or some other stimulus), the UART will then be used for DTM commands. If the device powers up normally and does not go into PTM mode, then the UART can be initialized by the application and used to communicate with the other device. DTM commands can also be called by the embedded BLE application.

    Since PTM uses the UART pins that drive the Display interface, there is a conflict present.  You must create two UART instances to service each function.  Here is a similar E2E thread: https://e2e.ti.com/f/1/t/1078493 

    Regards,
    Ryan

  • Hi Ryan,
    Thanks for the support, I have closed the PTM from SysConfig, I could see message on the terminal now. It is working fine.

    Best regards,
    Lulu