3 Replies Latest reply on Apr 6, 2016 11:02 PM by jobi

    psoc 4 uart serial read write

    sharmi91la_1561096

      How to serial print string via bluetooth device, there is only uart putchar option.

         

      condition-

         

      I am transmitting a word to bluetooth device via uart.

         

      Synchronously I would like to receive a continuous string[size n]  from the bluetooth device without any break from transmission data. 

         

       

         

      For eg. I transmit "hello" from psoc over uart

         

      and would like to receive any string eg. "Apple"

         

      what i get : helloAhellophellophellolhelloe..

        • 1. Re: psoc 4 uart serial read write
          user_242978793
                  Please send you project code so we can determine what is wrong with your code.   
          • 2. Re: psoc 4 uart serial read write
            sharmi91la_1561096

            simple uart tranmit receive using psco 4 protype kit, trogh pins 7.0 for  rx and 7.1 for tx. I receive data "HELLO" in my bluetooth device(HC05) terminal however receive data not showing up on serial window connected to com port of psoc.

               

            #include <project.h>
            #include "string.h"
            int main()
            {
                CyGlobalIntEnable; /* Enable global interrupts. */
                UART_Start();
                char8 rxData;
                //int i;
                //Tx_Start();
                /* Place your initialization/startup code here (e.g. MyInst_Start()) */

               

                for(;;)
                {
                   UART_UartPutString("HELLO");
                    //Tx_PutString("H");
                   CyDelay(1000);

               

                rxData = UART_UartGetChar();
               if (rxData){
                UART_UartPutChar(rxData);}
            CyDelay(1000);
                    /* Place your application code here. */
                }
            }

               

            /* [] END OF FILE */

            • 3. Re: psoc 4 uart serial read write
              jobi

              It seems like you are sending the HELLO in a for loop.

                 

              You are only waiting to get a single char, not the complete string.

                 

              Either you can have a counter to wait until all the char is received or to check for a special character as end of string.

                 

              Thanks

                 

              JOBIN GT

              1 of 1 people found this helpful