Reduced time for UART Bootloader(AN68272)

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

cross mob
MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

We are considering UART Bootloader with reference to AN 68272.

However, the time required for writing is long.

Therefore, I set the baud rate to 57600, but it still takes 8 minutes.

I confirmed the source code to speed up.

On line 199 in UART_BOOT.c,
"CyDelay (UART_BYTE 2 BYTE_TIME_OUT);" has a waiting time of 25 ms written.

We tried writing with this setting at 2 ms.
With this change, the writing that took 8 minutes has been shortened to about 50 seconds.
It is working without error.

Please confirm that this change is not a problem.

And do you have any material that understands why this is set to 25 ms?

0 Likes
1 Solution
GeonaP_26
Moderator
Moderator
Moderator
250 solutions authored 100 solutions authored 50 solutions authored

Hello Mineda-san, Byte to Byte time out for detecting end of block data from host. This has to be set to a value which is greater than the expected maximum delay between two bytes during a block/packet transmission from the host. User needs to account for the delay in hardware converters while calculating this value, if you are using any USB-UART bridges. Regards, Geon

View solution in original post

5 Replies
MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

We speculate that the AN 68272 covers a low baud rate and thus increases this waiting time "CyDelay (UART_BYTE 2 BYTE_TIME_OUT);".

It is best to tell us the reason why it is set to 25 ms.
If it is not possible, please tell us the recommended waiting time for the baud rate.

For example,
19200 bps, AA ms.

38400 bps, BB ms.

57600 bps, CC ms.

0 Likes
GeonaP_26
Moderator
Moderator
Moderator
250 solutions authored 100 solutions authored 50 solutions authored

Hello Mineda-san, Byte to Byte time out for detecting end of block data from host. This has to be set to a value which is greater than the expected maximum delay between two bytes during a block/packet transmission from the host. User needs to account for the delay in hardware converters while calculating this value, if you are using any USB-UART bridges. Regards, Geon

MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

Geon-san,

Thank you for your reply.

We wondered that a very long timeout was set.

I understand why the timeout is set to 25 ms in your explanation.
We don't use the USB-UART bridge, and communication between the host and the PSoC 5 LP is using UART only.
Since the baud rate is 57600 bps.

It was judged that there is no problem even in 2 ms.
As a precaution we will try shorten this timeout and confirm for the current margin.

Regards,Masashi

0 Likes
GeonaP_26
Moderator
Moderator
Moderator
250 solutions authored 100 solutions authored 50 solutions authored

Hello Masashi-San,

Byte-to-byte intervaltime interval is defined as the time consumed to transfer two data elements with selected data rate. For more details make use of section: SCB_CyBtldrCommRead details of PSoC 4 SCB datasheet.

For 57600 bps, 1 bit takes ~17.3 us. Consider 20 bits or 2 bytes transfer (2* (8 bits + Start bit + Stop bit) ) , so SCB_UART_BYTE_TO_BYTE = 17.3 ms * 20 = ~346 us.

In PSoC 4 SCB based UART, it is calculated by the component based on current data rate selection unlike UDB based UART. Another alternative is to use SCB_PSoC4 in bootloader project to get value of SCB_UART_BYTE_TO_BYTE (*_BOOT.h file) and then use it for UART(UDB based). However, you need to convert it to closest mS value. In above example it would be 1ms. Hope this helps.

Best Regards,

Geona Mary

MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

Geona-san,

Thank you for detailed calculation results.
I understood well why the timeout was set for a long time.

Masashi

0 Likes