UART communication

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello everyone,

   

                      I want to send a variable string (for eg.: varying ADC value) to a computer using SCB-UART component. How can I achieve this?

   

The kit I am using is CY8CKIT-042-BLE and I also making use of TeraTerm emulator to observe the string sent via UART. Is there any api that I can make use of in order to send a variable string of characters??

0 Likes
1 Solution
Anonymous
Not applicable

Most of the projects in https://github.com/cypresssemiconductorco/PSoC-4-BLE/tree/master/100_Projects_in_100_Days use UART debug interface using printf commands. Just add the debug.c/.h file from any one of these projects to your own, bring the SCB-UART component to the TopDesign, start the component in main file and set the CyDwr -> Systems Tab -> Heap Size to 200 bytes (for a start). After this, you can use the printf comand (exact syntax) to send strings of any kind. In case you get a hard fault, increase the heap size.

View solution in original post

0 Likes
4 Replies
Anonymous
Not applicable

Most of the projects in https://github.com/cypresssemiconductorco/PSoC-4-BLE/tree/master/100_Projects_in_100_Days use UART debug interface using printf commands. Just add the debug.c/.h file from any one of these projects to your own, bring the SCB-UART component to the TopDesign, start the component in main file and set the CyDwr -> Systems Tab -> Heap Size to 200 bytes (for a start). After this, you can use the printf comand (exact syntax) to send strings of any kind. In case you get a hard fault, increase the heap size.

0 Likes
Anonymous
Not applicable

Thank you for your reply roit

   

I will give it a try

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

I built the following code.

   

#include <project.h>
#include <stdio.h>
int main()
{
    CyGlobalIntEnable; /* Enable global interrupts. */
    UART_Start();
    UART_UartPutString("Hello Aneesh \n\r");
    UART_UartPutString("Let us check whether this works \n\r");
    for(;;)
    {
        float i;
        char txdata[16];
        
        for(i=0;i<10;i++)
        {        
            CyDelay(1000);
            snprintf(txdata,50,"%f",i);
            txdata[15]='\0';
            UART_UartPutString(txdata);
            UART_UartPutString("\n\r");
            CyDelay(1000);            
        }
    }
}

   

 

   

I used the SCB UART component.The code was successfully built and programmed in the CY8CKIT-042BLE.

   

I am using Tera-Term for emulating the Hyper terminal.  

   

This code (UART_UartPutString(txdata); ) should display the txdata. But this string is not displayed on the screen. What may have gone wrong?

   

I have also attached a workspace bundle regarding the same. Also is there any API in PSoC IDE that performs a similar function as serial.println() in Arduino IDE 

0 Likes
Anonymous
Not applicable

Could you explain me how can you use TeraTerm? Is it possible to use USB Dongle as GATT Server and a smartphone as GATT client?

   

If I plug the USB dongle I can't see the bluetooth name in discover BT on my phone. 😞

   

Thank you!

0 Likes