Problem receiving continuous Data from UART sensor Using PSoC 063

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

cross mob
lock attach
Attachments are accessible only for community members.
TinasheChamu
Level 1
Level 1
First reply posted 5 sign-ins First question asked

I'm trying to read continuous data from a UART proximity sensor using PSoC 6.  I'm getting the data mixed with garbage on tera Term .I am not sure how to receive the data correctly . If anyone can also advise on interfacing Pmod based SPI and I2C sensors to PSoC 6

 

I will attach my code and the output and here is part of the sensor data sheet info:

The Pmod MAXSONAR communicates with the host board via the UART protocol, analog output, and PWM timing. The module requires 250 milliseconds to power up and then will perform a self-calibration if the Receive Data (RX) pin is left at floating or logic level high voltage. The calibration will take 49 ms, and after an additional 100 ms of waiting time, the module will be able to take measurement readings every 49 milliseconds.

The UART protocol is configured with a baud rate of 9600, 8 bits, no parity, and a single stop bit. When the RX pin is left floating or held at a logic level high voltage, 5 bytes will be sent out over the Transfer Data (TX) pin beginning with the capital ASCII character 'R', three ASCII digits representing the detected distance, and a carriage return character (ASCII character 13).

An analog signal representative of the measured distance of the object in front of the Pmod MAXSONAR may also be read. The output itself has nine bits of resolution, so with a power supply at 3.3V each inch is equivalent to ~6.4 mV. Users that are measuring the incoming analog signal with a popular 10-bit ADC will have to divide their measured value by 2 before calculating the reported distance.

The Pmod MAXSONAR also provides distance data through a pulse-width modulation signal. Every 147 uS that the pin is measured at a logic level high voltage state is equivalent to 1 inch away. If the signal is measured to be high for 2.205 milliseconds, then the detected object is 15 inches away from the front of the Pmod MAXSONAR. The maximum measured pulse time of 37.5 milliseconds indicates that there is no object within 255 inches of the Pmod.

0 Likes
1 Solution
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

Have you gone through the following PSOC 6 UART code example? If not, can you please go through it?

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

The following code example of PSoC 6 in Modus Toolbox will help you to understand how to configure the Timer component to measure the pulse-width of the incoming waveform.

https://iotexpert.com/psoc-6-tcpwm-pulse-width-measurement/

The following code example is for using ADC in PSoC 6 in Modus.

https://github.com/cypresssemiconductorco/mtb-example-psoc6-adc-basic

Please go through the above three code examples and try to use which is more convenient to you for your present application. Kindly update us if you still see the issues.

Thanks

Ganesh

View solution in original post

0 Likes
1 Reply
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

Have you gone through the following PSOC 6 UART code example? If not, can you please go through it?

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

The following code example of PSoC 6 in Modus Toolbox will help you to understand how to configure the Timer component to measure the pulse-width of the incoming waveform.

https://iotexpert.com/psoc-6-tcpwm-pulse-width-measurement/

The following code example is for using ADC in PSoC 6 in Modus.

https://github.com/cypresssemiconductorco/mtb-example-psoc6-adc-basic

Please go through the above three code examples and try to use which is more convenient to you for your present application. Kindly update us if you still see the issues.

Thanks

Ganesh

0 Likes