A1: There is an API named UART_SPIUartGetRxBufferSize() which gives you the amount of bytes still in buffer. As long as non-zero, you can retrieve the data by using UART_UartGetByte(). Easiest configuration is to use an Rx buffer size of 20 to 80 and let the component handle the interrupt itself.
A2: Common error is not to clear the component's interrupt, program will loop in handler infinitively.
A3: Government health warning: never read the generated .c files, there is absolutely no need for. ;-)
Instead I would suggest to read the component datasheet to get a feeling how it is designed to work. Every component available for your selected PSoC is listed in the Component Catalog window, the datasheet is always just a mouse-click away.
I have small problem.
I wrote small project for distance measuring by sonar sensor HC-SR04.
The distance is mesured using timer (numbetr of samples is represent distance) and I would like send it to PC (Matlab) using Uart.
I used CY8CKIT-049-42xx
The problem is that, I don't see any received data in hyperterminal but data are transmiting (I try measure pulses at output Tx pin using osciloscope and the all is well).
Can you help me?
Thank you wery wery much.
Sonar_radar.cywrk_.Archive01.zip 586.8 K
I guess it is better to open another thread to ask a new question.
Anyway, firstly I think you have to check again to verify whether the transmit signal is correct, for example the baudrate, start/stop/parity bit etc. If everything is correct, it is not the problem of the Cypress chip, it is the problem of the receiving side, that is your computer.
Then please check whether you have used a correct TTL-to-computer converter. you can check the converter by wire its transmit pin to the receive pin, send something on the hyperterminal and check whether you receive the same thing.
When you connect the converter to your board, remember to wire the RX pin of the converter to the TX pin of your board. And remember to wire the "ground" pin.
You will have to use the buit-in USB-UART bridge of your CY8CKIT-049-42xx board. This requires the Rx and Tx pins to be set to P4_0 and P4_1. Have a look into the kit schematics. No converter needed for this.
Open windows device manager, look at the com-ports and then plug in your board. A new com-port will appear. Not its number and configure your terminal emulator accordingly.
Be sure just to send ASCII data. If still in doubt, post your actual project.
I'm used the miniprog3 for programing. The miniprog was conected to SWD. The UART was conected to P4.1,P4.0 and GND directly to my PC-UART (9 canon in dockstation). I see the com port in my device manager.
I'm cant find where is error :(.
Thank you very very much for your help.
The USB bridge is working well.
Why is not work direct connection Rx-TX to UART in dock station?
You can easily destroy your PSoC by connecting it directly to your PC 9-pin com port. The reason is that the PC uses RS232 voltage levels which are +- 12V. When you want connect directly as Typoon already said: "Then please check whether you have used a correct TTL-to-computer converter. ". There are chips for interfacing as the well-known MAX232.