4 Replies Latest reply on Mar 23, 2016 4:12 AM by f.capiluppi_1613771

    UART communication

    amnreader21_1609901

      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??

        • 1. Re: UART communication
          rohit.kumar

          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.

          • 2. Re: UART communication
            amnreader21_1609901

            Thank you for your reply roit

               

            I will give it a try

            • 3. Re: UART communication
              amnreader21_1609901

              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 

              • 4. Re: UART communication
                f.capiluppi_1613771

                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!