- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was looking into UART communication and was able to send and receive data by connecting UART RX and TX pins with help of example code below:
int main()
{
uint8 ch;
/* Start SCB (UART mode) operation */
UART_Start();
UART_UartPutChar(48);
for (;;)
{
ch = UART_UartGetChar();
if (0 != ch)
{
UART_UartPutChar(ch);
}
}
}
Is there any example code online where I can find how to use interrupt for RX or any documentation for APIs.
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Easiest way: let the component handle the interrupts. Set the Rx and Tx buffer sizes to 80. You can question the number of chars received using SCB_SpiUartGetRxBufferSize() which returns the number of bytes in the buffer, not the size.
internal clock for SCB, I can't change the baud rate That's not right, you can select a baud rate from the drop-down list or even type a number. External clock is meant extern to the component, connect a clock component to the terminal.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Important : I need SCB example / APIs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just right click on your component and select "Find Example Project"
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the help. I found the example code and it doesn't have the interrupt routine, but after reading component datasheet I have plenty of information for setting interrupts on RX and TX pins.
Another question: As far as I can read/find if I use internal clock for SCB, I can't change the baud rate so I need to use external clock. My question is, does "External clock" means clock from terminal where I provide clock using drag and drop ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Easiest way: let the component handle the interrupts. Set the Rx and Tx buffer sizes to 80. You can question the number of chars received using SCB_SpiUartGetRxBufferSize() which returns the number of bytes in the buffer, not the size.
internal clock for SCB, I can't change the baud rate That's not right, you can select a baud rate from the drop-down list or even type a number. External clock is meant extern to the component, connect a clock component to the terminal.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Easiest way: let the component handle the interrupts. Set the Rx and Tx buffer sizes to 80. You can question the number of chars received using SCB_SpiUartGetRxBufferSize() which returns the number of bytes in the buffer, not the size.
I will look into it. Seems cleanest way.
External clock is meant extern to the component, connect a clock component to the terminal.
My bad. I meant terminal. I was going through your thread http://www.cypress.com/forum/psoc-3-device-programming/can-i-change-uart-baud-rate-run-time and downloaded your project as well, I have some questions
1) Why 1.843 ?
2) How you find out which divider is for which baud rate ?
3) Is baud rate generated by divider reliable ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your link is a 404
1) don't know the context of that number
2) using internal clock and looking at the generated clock values
3) That depends on the clock accuracy, normally that works flawlessly. When talking to a device with stronger requirements a crystal or external precision clock might be needed.
Bob