Issue with program retention in CY8CKIT-049-42XX

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

cross mob
KJ_1509691
Level 1
Level 1

Hello,

   

I successfully programmed the kit along with the bootloader and found it to be working satisfactorily. I am using the serial port program mode as I do not have Mini Programmer. I even power cycled it multiple times and it was working fine.

   

If I switch on the power after a day, the kit automatically goes in to bootloader mode and the main program does not work.

   

I anticipate that the bootloader is working fine however the main program is getting corrupted. Any pointers in this regards will be helpful.

   

Thank you in advance.

   

Kuldeep

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello,

   

I have created a simple example project for using the exclude checksum. As you mentioned in the forum post it is not possible to reserve  0000 to 7fff for checksum exclude. The checksum exclude function will be placed just below the metadata address.Please refer to the cm0gcc.ld file with the checksum exclude section enabled.Then you can see the placement of checksum exclude section.

   

In this project I have used the SCB UART bootloader project and the Emulated EEPROM component example project as bootloadable. I have reserved 40 bytes for checksum exclude.The emulated EEPROM array I have declared inside the checksum exclude section. Please note that this project is not 100% tested for all variations. This is just a sample project.

   

 

   

Thanks,

   

Hima

View solution in original post

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

Welcome in the forum, Kuldeep, and a happy new year!

   

We have seen issues like yours with (very) bad power supplies. Do you use emEEProm component or are you writing to flash with your bootloaded program?

   

Can you post both your complete projects, Bootloader and Bootloadable, so that we all can have a look at all of your settings? To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
KJ_1509691
Level 1
Level 1

Hello Bob,

   

Happy New Year to you as well.

   

Thank your for the reply. I found your other posts helpful for solving my problems till date.

   

I have attached my demo code. Yes, I am using the emEEProm component, The kit is powered from the USB port. As the PCB is a loose fit into the USB post, there may be a possibility of power fluctuations.

   

Today morning too l am facing the same problem.

   

Thank you in advance.

   

Regards,

   

Kuldeep

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

Kuldeep,

   

there was an issue posted by a user (SpiderKenny??) concerning Bootloadert and emEEProm. As far as I remember, a workaround was to manually call the die-temperature function. I would suggest you (as a try) to disable the access to the emEEProm.

   

Another issue will be: changing a byte within your code area will change the checksum of the bootloadable, thus telling the bootloader that the bootloadable is invalid and a new upload is required.

   

And lastly: In your interrupt handler for SER you only handle and reset your expected interrupt, all others you do not clear which may turn out to be an infinite loop when there are any errors.

   

 

   

Bob

0 Likes
KJ_1509691
Level 1
Level 1

Dear Bob,

   

Access to the eeprom is integral to my logic and I will have to use it. I will look into the workaround. One peculiar thing in my case is the bootloader is working fine (on the second day) however the bootloadable program is failing.

   

This is occurring even when I am not accessing the eeprom on the earlier day (ie no read or writes), if you see my code the eeprom is modified only if there is a serial char received.

   

If the checksum was the problem then immediately on the next power cycle the device should complain. and not a day afterwards.

   

I did not look into much details for the SER interrupt as this was proof of concept program, but will do so in the final prog. Presently I am sure that none of the errors are causing infinite loop. Still thank you for the pointer.

   

Do you think raising a case with cypress will help?

   

 

   

Regards,

   

Kuldeep

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

Do you think raising a case with cypress will help? Probably! Provide them with a workspace bundle and a link to this thread.

   

On the other side, I would check by disabling the emEEProm access for testing to get a clue whether this causes the error or if other circumstances lead to your observed errors.

   

 

   

Bob

0 Likes
KJ_1509691
Level 1
Level 1

Hello Bob,

   

I am having a feeling that the issue is with the em_EEPROM and checksum in case the content is modified.

   

I was wondering, how do I workaround the problem if it is with the checksum. Can I  place the variables in bootloadable code at the beginning, so as to direct the bootloadable block to avoid that area for checksum computation?

   

Can you please give me  links where I may find further information.

   

Kuldeep

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

At least I'd try setting "Bootloader application validation", search Bootloader's datasheet for "checksum" (that's what I did)

   

 

   

Bob

0 Likes
KJ_1509691
Level 1
Level 1

Hi Bob,

   

I have solved the problem.

   

The bootloader was configured with the initial flash memory as write protected. I was uploading the code over the serial port, using a bootloader utility. I guess this portion of the code was not getting modified, even when I tried uploading the code through the serial port. (I am not sure if this is the case, as I have superficially read the flash programming details).

   

I could lay my hand on a MiniProg and programmed with the flash memory as unprotected and configured the bootloader with fast bootloadable application validation option, This solved my problem.

   

From this experience, I feel it would be great if cypress could provide option for keeping the em_EEPROM data out of checksum preview. It would also be helpful if we can configure the address area and size to be used, and group the set of eeprom variables using precompiler directive.

   

 

   

Kuldeep

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

In Bootloader datasheet search for "Checksum", you'll find some hints to exclude areas from checksum protection, but I've never tried to implement this.

   

 

   

Bob

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

Hello Kuldeep,

   

Glad that your issues are resolved. I don't think the write protection of Bootloader might have caused the issue.The bootloader Flash region will get modified and it is recommended to have the Bootloader area protected.

   

For excluding a particular region from checksum calculation you can use the new feature in bootloadable component.You can give the size of the area that need to be excluded from the checksum calculation.This area will be placed at the end of flash just before the metadata region.After giving the size, a new section called cy_checksum_exclude. Now you need to declare your array in this section.

   

Please refer to AN89610:PSoC® 4 and PSoC 5LP ARM® Cortex® Code Optimization(Link:http://www.cypress.com/file/46521/download) to understand how to place a variable in different section sof Flash.

   

Thanks,

   

Hima

0 Likes
KJ_1509691
Level 1
Level 1

Hello Hima,

   

Thank you for your reply. Can you please give me a sample project which uses cy_checksum_exclude for PSoC4.

   

Please also let me know as to how to mark only the bootloader portion of code in flash to be write protected. Or do I go by the default setting of 0000 to 7fff as given in the sample code??

   

>>I don't think the write protection of Bootloader might have caused the issue.

   

You mean to say that if I was using the serial UART mode to download the bootloadable code along with the bootlodader, it should have overwritten the write protected portion of flash as well??

   

 

   

Thank you in advance

   

 

   

Regards,

   

Kuldeep

0 Likes
KJ_1509691
Level 1
Level 1

Correction:  0000 to 07ff

0 Likes
lock attach
Attachments are accessible only for community members.
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello,

   

I have created a simple example project for using the exclude checksum. As you mentioned in the forum post it is not possible to reserve  0000 to 7fff for checksum exclude. The checksum exclude function will be placed just below the metadata address.Please refer to the cm0gcc.ld file with the checksum exclude section enabled.Then you can see the placement of checksum exclude section.

   

In this project I have used the SCB UART bootloader project and the Emulated EEPROM component example project as bootloadable. I have reserved 40 bytes for checksum exclude.The emulated EEPROM array I have declared inside the checksum exclude section. Please note that this project is not 100% tested for all variations. This is just a sample project.

   

 

   

Thanks,

   

Hima

0 Likes
KJ_1509691
Level 1
Level 1

Thank you it works.

0 Likes