For the assignment for this week, was implemented serial communication between two PSoC microcontrollers. As an upgrade of development achieved in previous assignments (Input Devices and Output Devices ), the objective was read the distance from the sensor on a microcontroller and transmit this data to another microcontroller.

In the GUI, an UART (Universal Asynchronous Receiver Transmitter) block was added. This block enables serial communications on PSoC platform. The block was connected to pins for transmit (TX) and receive (RX), the speed for transmission was set as 256 bits per second, also, the character '+' was set as "Command Terminator" for message termination transmitted.

Some little changes were made in previous (Input Devices and Output Devices ) code:

  • Initializing UART block
  • Sending out the message
  • Clearing out some flags sfter transmission.

For the message, two strategies were tested:

  1. Sending out strings
  2. Sending out integer values (data are read from the analog input "ADCData")

With both strategies it was obtained similar performance.

Portions of code additions, (lines 121 to 124), to previous one, are shown below.

A commercial development PSoC board ( CY3210-PSoCEval1 )was used as remote receiver and was set up in a similar way as transmitter microcontroller. CY3210-PSoCEval1 Development Board

Transmitter and Receiver boards were connected through two separate cables for transmission and reception respectively as follows:

  • Transmitter TX pin to Receiver RX pin
  • Receiver TX pin to Transmitter RX pin

The code necessary for receive string values is shown as follow:

Notes :

  1. In this code, the board waits for the termination token to be detected using UART_1_bCmdCheck() (line 42)
  2. It stores the string in the buffer with a pointer (lines 44-58)
  3. It displays the string in the LCD (lines 61-62).
  4. The flag for the termination token is reset (line 64).
  5. The process started all over again (command "while" beetween lines 36 and 71) .

At first trials a little bug in transmission-receiving was detected and after checking and debugging, setting up a common ground for both boards let transmit and receive right values.

First attempts to transmit and receive:

After a common ground was set up:

The "little network" working alone (without connection to PC):