PSoC5LP bootloader with SPI transport

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

cross mob
JaSi_1632926
Level 4
Level 4
Welcome! 25 replies posted 10 replies posted

Hi,

I'm trying to get bootloader with SPI transport to work. I have something that usually works, but it's very fragile - basically the PSoC bootloader logic doesn't handle extra bytes in the communication very well.

The issue with SPI (vs UART) is that the host need to send data in order to read data from the slave (=PSoC). This data ends up in the incoming buffer on the PSoC side, and the bootloader will fail when it contains unexpected data. We have tried to send 0x00 and 0x01 from the host as dummy data (while reading data from the slave), but in both cases it fails.

The bootloader protocol should allow both these numbers as 'dummy data' that is thrown away - the bootloader doesn't seem to have proper parsing (that is, erroneous data in the incoming buffer should be thrown away).

Our current 'solution' is having sleeps here and there in the host code that make sure that we only read when the PSoC is ready. However, this is very error-prone and slow.

Is there a solution to this? I know I can fix it on the PSoC side by overriding CyBtldrCommWrite, parse the data received and only deliver it to the bootloader logic in case it's valid bootloader protocol data - but should I really have to do that? It really should be handled by the bootloader internally.

Thanks, Jacob

0 Likes
1 Solution
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello,

The current Bootloader component implementation expects the data to be as per the Bootloading protocol. There must not be extra bytes. Also the commands must be send only when the SPI slave is active.

May be you can use another Pin from slave which will interrupt the master and master can start sending data. SPI protocol is Master oriented so only Master can have control.

Thanks,

Hima

View solution in original post

0 Likes
3 Replies
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello,

The current Bootloader component implementation expects the data to be as per the Bootloading protocol. There must not be extra bytes. Also the commands must be send only when the SPI slave is active.

May be you can use another Pin from slave which will interrupt the master and master can start sending data. SPI protocol is Master oriented so only Master can have control.

Thanks,

Hima

0 Likes

Hi,

Well, that doesn't fit very well with SPI to be honest. It's interesting this I can't see that this is mentioned in AN84401 (PSoC® 3 and PSoC 5LP SPI Bootloader)..?

The extra pin would require extra code on the PSoC side.

Thanks, Jacob

0 Likes

Yes you will need to add extra code in the bootloader as well as host code.

thanks,

Hima

0 Likes