- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My RF module works with UART. I'm using TX UART for the transmitter side.
I would like to send [0x55,0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,0x00,0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xAB, 0xBC, 0xCD] with the help of UART.
I use the program I added.
but I can't get the result I want. Where am I making a mistake?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Please try the attached program and check if it meets your requirement.
Thanks and regards
Harigovind
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What baud rate are you going to use?
As the UART_1 component says in its configuration utility tool, the baud rate is set to 2500bps.
If you want to use 57600bps there are two solutions.
SOLUTION 1 :
Set the Clock_1 frequency to 57600*8=460,800Hz as follows.
In this case, the actual baud rate becomes 57692bps
SOLUTION 2 :
Configure the UART_1 component to use an internal baud rate clock.
Then specify the expected baud rate.
Regards,
Noriaki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Additional hint.
If you want to receive a character 0x00, use UART_1_GetByte() instead of UART_1_GetChar()
Regards,
Noriaki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It gives error when I use this code."UART_1_GetByte() "
.\ARM_GCC_541\Debug\main.o: In function `main':
C:\Users\TOSHIBA1\Desktop\UART_Tx01\UART_Tx01.cydsn/main.c:56: undefined reference to `UART_1_GetByte'
collect2.exe: error: ld returned 1 exit status
The command 'arm-none-eabi-gcc.exe' failed with exit code '1'.
--------------- Build Failed: 06/18/2019 09:39:44 ---------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, I was looking into the RX side project.
The UART TX has 4 bytes of FIFO as default. When the FIFO is exhausted, the FIFO overwritten and unexpected TX output will be observed.
This is because the function UART_1_WriteTxData() does not block even if the FIFO is FULL.
SOLUTION 1 :
Check the FIFO status by the function UART_1_ReadTxStatus() before calling the UART_1_WriteTxData()
while (!(UART_1_ReadTxStatus() & UART_1_STS_FIFO_NOT_FULL));
UART_1_WriteTxData(0xAA);
while loops are required for all _WriteTxData() function.
SOLUTION 2 :
Use blocking function UART_1_PutChar() instead of UART_1_WriteTxData()
CPU waits until the FIFO is not FULL.
Regards,
Noriaki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It gives error when I use this code.
arm-none-eabi-gcc.exe -mcpu=cortex-m3 -mthumb -I. -IGenerated_Source\PSoC5 -Wa,-alh=.\ARM_GCC_541\Debug/main.lst -g -ffunction-sections -ffat-lto-objects -O0 -c main.c -o .\ARM_GCC_541\Debug\main.o
main.c: In function 'main':
main.c:56:35: error: 'UART_1_STS_FIFO_NOT_FULL' undeclared (first use in this function)
while (! (UART_1_ReadTxStatus()& UART_1_STS_FIFO_NOT_FULL));
^
main.c:56:35: note: each undeclared identifier is reported only once for each function it appears in
The command 'arm-none-eabi-gcc.exe' failed with exit code '1'.
--------------- Build Failed: 06/18/2019 10:36:17 ---------------
Which one do I need to choose in this window?
TX on TX complate
TXon FIFO EMPTY
TXon FIFO FULL
TXon FIFO NOT FULL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am very sorry.
It's a TYPO. "_TX" is missing.
while (!(UART_1_ReadTxStatus() & UART_1_TX_STS_FIFO_NOT_FULL)) ;
UART_1_WriteTxData(0xAA);
Regards,
Noriaki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think there's a mistake.
The correct logical output should be as follows.
I can't find where the error is.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As the UART protocol, each byte is consisting of START BIT, DATA BITS, and STOP BITS as the "TX" signal of the following figure from the UART datasheet.
If you don't want to have START BIT and STOP BITS, Shift Register may be used.
Please refer the "Shift Register" component.
Regards,
Noriaki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't want to use start and stop bits. How do I use Shift Register where.
Can you help with this?
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think there's a mistake somewhere. It doesn't look like we want results.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When I use UART_1_PutChar () it changed as in the figure.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried them all separately. but the result is the same.