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.

CCS/CC2640R2F: How to send and receive data in Tera Term?

Part Number: CC2640R2F

Tool/software: Code Composer Studio

Hi

My code is simple peripheral

I want to send and receive data to PC. 

I wrote these codes in periodic task: 

SimpleProfile_SetParameter( SIMPLEPROFILE_CHAR4, sizeof(uint8), &valueToread);
SimpleProfile_GetParameter( SIMPLEPROFILE_CHAR1, &valueTowrite);

Then I could see the data sent in my phone. Now I want to see this in my PC, too. But Ter Term and puTTy do not show the data. 

Do I need to write some other codes? (What code?) Or install another Terminal? What should I do?

  • Hi,

    The simple peripheral will default output to serial console, just set the correct COM Port and Baud Rate 115200.

    -kel

  • Hi,

    In the simple peripheral example, the display driver is used for the UART display. You can see how to set up the terminal program in the example readme:

    http://dev.ti.com/tirex/explore/node?node=AAPRCvX3mZ-3h37zUt8ehQ__krol.2c__LATEST

    To write something to the display you can use the Display_printf() API. Please see the display driver documentation:

    http://dev.ti.com/tirex/content/simplelink_cc2640r2_sdk_3_40_00_10/docs/tidrivers/doxygen/html/_display_8h.html

     

  • Hi Marie

    Thank you for your reply

    I read the display.h File and simple peripheral articles. 

    Then I wrote the display code in the beginning of the main.c. I want to display a simple "Hello World" first.

    I tested puTTy, Tera Term, and the ccs serial terminal. I tested with both com ports. But nothing showed. I defined a parameter named: "test_main" to see were has the program stuck. 

    So as you can see below all the codes for displaying "Hello World" has performed. But nothing has shown. 

    Where is the problem?

  • Hi Markel

    Thanks for your reply

    I couldn't see something displaying in the terminals.

    You can see my answer to Marie above.

    I will appreciate any help.

  • Hi,

    The Display_open() is initialized at simple_peripheral.c -> SimplePeripheral_init(). Try the Display_print0() after  Display_open().

    -kel

  • Try opening the UART instead of "Host" - this is from the display example:

    /* Open both an available LCD display and an UART display.
         * Whether the open call is successful depends on what is present in the
         * Display_config[] array of the board file.
         */
        Display_Handle hLcd = Display_open(Display_Type_LCD, &params);
        Display_Handle hSerial = Display_open(Display_Type_UART, &params);
    
        if (hSerial == NULL && hLcd == NULL) {
            /* Failed to open a display */
            while (1) {}
        }
    
        /* Check if the selected Display type was found and successfully opened */
        if (hSerial) {
            Display_printf(hSerial, 0, 0, "Hello Serial!");
        }
        else
        {
            /* Print unavail message on LCD. Note it's not necessary to
             * check for NULL handles with Display APIs, so just assume hLcd works.
             */
            Display_printf(hLcd, 4, 0, "Serial display");
            Display_printf(hLcd, 5, 0, "not present");
            sleep(1);
        }
    
        /* Check if the selected Display type was found and successfully opened */
        if (hLcd) {
            Display_printf(hLcd, 5, 3, "Hello LCD!");
    
            /* Wait a while so text can be viewed. */
            sleep(3);
    
            /*
             * Use the GrLib extension to get the GraphicsLib context object of the
             * LCD, if it is supported by the display type.
             */
            Graphics_Context *context = DisplayExt_getGraphicsContext(hLcd);
    
            /* It's possible that no compatible display is available. */
            if (context) {
                /* Calculate X-Y coordinate to center the splash image */
                int splashX = (Graphics_getDisplayWidth(context) - Graphics_getImageWidth(&splashImage)) / 2;
                int splashY = (Graphics_getDisplayHeight(context) - Graphics_getImageHeight(&splashImage)) / 2;
    
                /* Draw splash */
                Graphics_drawImage(context, &splashImage, splashX, splashY);
                Graphics_flushBuffer(context);
            }
            else {
                /* Not all displays have a GraphicsLib back-end */
                Display_printf(hLcd, 0, 0, "Display driver");
                Display_printf(hLcd, 1, 0, "is not");
                Display_printf(hLcd, 2, 0, "GrLib capable!");
            }
    
            /* Wait for a bit, then clear */
            sleep(3);
            Display_clear(hLcd);
        }
        else
        {
            Display_printf(hSerial, 1, 0, "LCD display not present");
            sleep(1);
        }

  • Hi,

    I replaced display_printf() with display_printf() in main.c

    But Nothing was showed. 

    What else can I do?

  • Have you tried just using the DISPLAY_TYPE_UART?

    Have you tried the display example by itself?

  • Hi Keith, thank you for your reply.

    I tried the code you have written above. But nothing was showed.

    I haven't tried the simplelink display example yet. I gonna try it and tell you that it worked or not.

  • The M S2,

    I just tested the ble5 simple peripheral example program by default it already outputs to Tera Term. So, why are you doing all that at main.c. Delete all that code at main.c  At serial console set the correct COM port and Baud Rate. As, I have mentioned before.

    "The Display_open() is initialized at simple_peripheral.c -> SimplePeripheral_init(). Try the Display_print0() after  Display_open()."

    -kel

  • I wrote the display code in the main.c because I hadn't seen output in Tera Term and other terminals before. So I wanted to test if the display function works for me or not.

    As I said before, the module I'm working with is HM-17 and not the launchpad. Do you think it doesn't work because it is not a launchpad?

    Thank you

    Mina

  • Hi 

    Yes you're right. I have to work on the hardware.

    Thank you again.

    Mina