Calculate SW_Tx_UART BaudRate error

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

cross mob
Anonymous
Not applicable

I am very new to Microcontroller and especially Cypress programming and have therefore been looking at the code examples. I am currently trying to understand the function of the SW_Tx_UART Component.

   

First of all I would like to know, how it is possible to change the clock the component is using? And how do  I know which it is currently using?

   

For documentation sake I would now like to calculate the expected baud rate error. The following formula is given in the SW_Tx_UART- Datasheet:

   

Divider = (int) (CPU_CLK+(BaudRate/2))/BaudRate
%err = (BaudRate - CPU_CLK/ Divider)*100% + CPU_CLK_Accuracy

   

But which values do I need to enter here? Is the CPU-CLK the same as the SYSCLK? I also don't know in which units the values have to be given since I don't seem to be able to fully understand the relationship between clock frequency and baud rate.

   

For example if the used clock is runnig at 48000000Hz (48MHz) and a I set a Baudrate of 115200 Bd that would give me a divider of 417.166 (ignoring the units). The result seems a bit high I think...

   

Any help in understanding the relations of clock and baudrate is much appreciated.

   

Thanks

0 Likes
6 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Welcome in the forum, nameless 😉

   

The component you are referring to is a pure software solution, it does not use any clock but the execution clock for the CPU. So there is no way to change the clock frequency.

   

When you tell us a bit more what you would like to perform (except from understanding how it works) we could probably help you.

   

Let us know which Cypress Kit exactly you use.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

I'm using a CYBL10462-56LQXI to just mainly send some CapSense data to the PC ( I know there is the tuner for that, but it's just to play around and for me to see what happens at what time). Everything works fine.

   

It's really just about understanding, what I'm supposed to be calculating for the error, because I will eventually have to write a short report about what I am doing for my school.

0 Likes
Anonymous
Not applicable

On a side note: should I even be using the Software UART? It seemed very easy and does just what I need, plus the datasheet isn't 200 pages long. But since it uses "software delays, implemented with CyDelay function" does it slow down the execution a considerable amount? I find it hard to judge how big a difference these delays will make.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

The software UART will disable interrupts during transmission of a byte to maintain timing. At 9600 Baud this will take more than 1ms.

   

Yes, I admit that the datasheet for SCB UART has got more than 200 pages, but it is describing several different interfaces, so the UART is quite less than 200 pages.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

First of, thank you for your answers so far.

   

So using 115200 bps that's around 0.1ms?

   

But for the Non-Software UART I would only block the CPU while writing the data into the buffer register,so I should use that one, especially since I'm polling the CapSense - Sensors all the time and want to evaluate what's happening when?

   

And one last question, just to be clear: is the UART the right way to go for very minimal, one way communication or should I also look into the other interfaces.

   

The 200 is just a bit intimidating if you're swimming in documents you just don't completely understand. I'm actually quite glad everything is so well documented.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

is the UART the right way to go for very minimal, one way communication

   

The UART is one of the simplest interfaces.

   

 

   

Bob

0 Likes