5 Replies Latest reply on Feb 20, 2019 10:57 PM by DheerajK_81

    how to configure two uarts on the psoc 6  wifi-bt kit ?

    mara_3933621

      We are working with psoc 6 and zigbee to receive data. We want to configure two uarts i.e. one for the zigbee (xbee pro s2b) and other for displaying data on tera term. We are unable to print the received data on tera term using psoc 6. We have tried writing programs on both softwares i.e. PSOC CREATOR and WICED yet there is no data on tera term. Please provide the necessary code and hardware changes if required.

        • 1. Re: how to configure two uarts on the psoc 6  wifi-bt kit ?
          YeshwanthK_56

          Hello,

           

          For printing Debug data on any terminal emulator, you have to use SCB5 only. Please refer to the following code example to understand reading and writing from terminal,

           

          https://www.cypress.com/documentation/code-examples/ce219656-psoc-6-mcu-uart-using-low-level-apis

           

          To communicate with the Zigbee device use any block other than SCB5. Reading and writing data should be fairly straight forward as the above example.

           

          Regards,

          Yeshwanth

          • 2. Re: how to configure two uarts on the psoc 6  wifi-bt kit ?
            mara_3933621

            ok. But i also need to use wifi features for which i guess i have to use WICED software only and not CREATOR. What should i do?

            My psoc 6 is CY8CKIT-062 Wifi Bt pioneer kit

            • 3. Re: how to configure two uarts on the psoc 6  wifi-bt kit ?
              YeshwanthK_56

              If you are using WICED, configure the UART block as shown below,

               

                  wiced_ring_buffer_t buffer;
                  uint8_t data[5];
                  ring_buffer_init(&buffer, data, 5);
                  static const wiced_uart_config_t uart_config =
                  {
                      .baud_rate    = 9600,
                      .data_width   = DATA_WIDTH_8BIT,
                      .parity       = NO_PARITY,
                      .stop_bits    = STOP_BITS_1,
                      .flow_control = FLOW_CONTROL_DISABLED,
                  };
                  wiced_uart_init(WICED_UART_6, &uart_config, &buffer);
              

               

              WICED_UART_6 is SCB5 in this case, check for your device in platform.c/.h

               

              Configure one more SCB in the same fashion to communicate with Zigbee module.

               

              Regards,

              Yeshwanth

              • 4. Re: how to configure two uarts on the psoc 6  wifi-bt kit ?
                mara_3933621

                hello,

                I have tried the same procedure as you mentioned, i'll attach my code , if you can please have a look and let me know where am i going wrong because i still cannot see any output on serial monitor

                 

                #include "wiced.h"

                 

                 

                void application_start()

                {

                   uint8_t expected_data_size=20;

                 

                    wiced_init();

                 

                 

                 

                  #define RX_BUFFER_SIZE (2000)

                 

                 

                   wiced_ring_buffer_t rx_buffer;

                    uint8_t rx_data[RX_BUFFER_SIZE];

                    ring_buffer_init(&rx_buffer, rx_data, RX_BUFFER_SIZE);

                 

                    wiced_uart_config_t uart_config =

                    {

                            .baud_rate =9600,

                            .parity = NO_PARITY,

                            .data_width= DATA_WIDTH_8BIT,

                            .stop_bits= STOP_BITS_1,

                            .flow_control = FLOW_CONTROL_DISABLED,

                    };

                 

                 

                    wiced_uart_config_t uart1_config =

                      {

                              .baud_rate =9600,

                              .parity = NO_PARITY,

                              .data_width= DATA_WIDTH_8BIT,

                              .stop_bits= STOP_BITS_1,

                              .flow_control = FLOW_CONTROL_DISABLED,

                      };

                 

                 

                     wiced_uart_init(WICED_UART_4,&uart_config , &rx_buffer);

                    wiced_uart_init(WICED_UART_6,&uart1_config , NULL);

                 

                 

                 

                 

                    while ( wiced_uart_receive_bytes(WICED_UART_4, &rx_data, &expected_data_size, WICED_NEVER_TIMEOUT ) == WICED_SUCCESS )

                       {

                        wiced_uart_transmit_bytes( WICED_UART_6, rx_data,RX_BUFFER_SIZE  );

                 

                 

                 

                 

                       }

                   }

                 

                 

                for serial debugging i hv used wiced_uart_6 and xbee i hv connected to uart 4 ,i configured the pins to port 6.2 and 6.3 and made the changes to platform.c .