Bootloader component not executing downloaded application

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

cross mob
Anonymous
Not applicable

Hello,

   

I'm attempting to verify my PSoC 5LP Bootloader/Bootloadable firmware using the CY8CKIT-059 Prototyping Kit.  I'm using the Host UART Bootloader program launched via the PSoC 3.3 Creator's Tool drop-down.  The download process appears to work fine, but the downloaded application is not being executed automatically after the download completes.  If I reset the board manually, the newly downloaded application executes as expected.   My concern is that we are planning to include the host bootloader software in our application, and we would prefer that the download process completes without user intervention.  Can someone help me determine if I am doing something wrong, or give me some advice as to how to make this process automatic?  

   

Thanks.

0 Likes
12 Replies
AnkitaS_51
Employee
Employee
100 likes received 50 likes received 25 likes received

Can you please provide us with your project

   

You can check some code examples in PSOC Creator's  "Code Example" option in File,also fill the Filter by option with bootload

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi ANKS,  Thanks for responding.  The attached file contains the projects for both the bootloader and bootloadable firmware.  As you can see, the bootloader doesn't do much besides call Bootloader_Start.

   

 

   

Thanks

   

Dave

0 Likes
AnkitaS_51
Employee
Employee
100 likes received 50 likes received 25 likes received

Hello Dave,

   

Using PSoC Creator4.0 IDE ,I first programmed the Bootloader project(DevBoard_Bootloader.cydsn) on CY8CKIT-059 Prototyping Kit.

   

The Pin_LED which is connected to P2_1,blinked with ON time of 127ms as expected.

   

When I programmed the DevBoard_LHSApp project's .cyacd file using Bootloader Host (UART :115200) tool.

   

The port P2_1 LED(connected to ActivityLED signal) started blinking with the ON time as decided by the ledCtr variable value,thus I observed that immediately after the bootloadable project got programmed by Bootloader Host,execution of bootloadable application started.

0 Likes
Anonymous
Not applicable

Hi ANKS,

   

I downloaded PSoC Creator 4.0.  I rebuilt the bootloader and application and downloaded both via the IDE.  The application started running as expected.  As you can see, the application accepts commands over the serial port (which is also used by the bootloader to get the new firmware code).  One of the commands, "UPG" is used to jump to the bootloader and begin the download process.  This is done using the command, "Bootloadable_Load()".

   

So here is my test:

   

1.  Launch TeraTerm to talk to the application.

   

2.  Enter UPG<ret> via TeraTerm

   

3.  Close TeraTerm

   

4.  Launch the Host Bootloader Utility

   

5.  Select the serial port

   

6.  Download the "cyacd" file

   

7.  Select another port in the Host Bootloader utility to close the current one.

   

8.  Open TeraTerm

   

9. Enter ? - Which should display a list of commands.

   

 

   

Results:

   

After I jump from my application to the Bootloader (via Bootloadable_Load) and download the new firmware vis the Host Bootload utility, the application program is not automatically executed.  After I close the port (also tried exiting the utility), then opened TeraTerm and entered a question mark, TeraTerm displayed a "check mark" character.

   

I  then closed TeraTerm and used the Host Bootloader utility to download the code (without entering the UPG command, which again indicates that the application was not executed), it will complete and this time, it will automatically execute the application.  

   

I repeated this test multiple times, each with the same results.  It appears that using the Bootloadable_Load command does something to prohibit the application from executing automatically.

   

Is there another way to achieve my goal of having the application jump to the bootloader?  I guess I could trash its checksum in flash, then just do a reset.  When the bootloader runs, it should then fail its application verification and wait for new code.

   

Thanks very much for your help, I really appreciate it!

   

Dave

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

In the bootloadable component datasheet page# 16 it is stated that-

   

Bootloadable_Load (void )
Schedules the Bootloader/Launcher to be launched and then performs a software reset to launch it.
Returns:
This method will never return. It will load a new application and reset the device.

   

"This method will never return" means that whatever you have return in the application after the execution of "Bootloadable_Load()"API will never get executed because it will cause a software reset everytime the API gets executed

   

 

   

I followed certain steps to recreate your issue-

   

1)First programmed the kit with the bootloader project(DevBoard_Bootloader.cydsn),thus the Pin_LED which is connected to P2_1,blinked with ON time of 127ms as expected.

   

2)Then ,I builded the Bootloadable project(DevBoard_LHSApp.cydsn),programmed using the Bootloader Host the .cyacd file.The port P2_1 LED(connected to ActivityLED signal) started blinking with the ON time as decided by the ledCtr variable value

   

3)Opened the Coolterm,connected the COM port and given the command UPG<ret>(snapshot attached).Device entered into the bootloader mode[Pin_LED which is connected to P2_1,blinked with ON time of 127ms as expected.]

   

4)Disconnected the COM port from Coolterm,and opened the Bootloader host utility and again programmed the .cyacd file of DevBoard_LHSApp.cydsn project.Again,the port P2_1 LED(connected to ActivityLED signal) started blinking with the ON time as decided by the ledCtr variable value which shows that it again started to execute the application.

   

Please explain why after programming second time the same.cyacd file, on Coolterm or TeraTerm you expect a display of list of commands automatically on Enter.

   

Are you programming second time with some other .cyacd file of some other project other than DevBoard_LHSApp.cydsn project.Then please provide that.

   

From my observation after step#4 mentioned,the device is executing the application code.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi ANKS,

   

I apologize if I've confused you.  The list of commands will only be displayed if you enter a question mark in the Coolterm window when the application is running.  So before you type UPG, enter a question mark, a small list of commands will be displayed.  After you enter UPG, the "Jumping to Bootloader" message is displayed and the application program is exited and the bootloader entered (I agree, BootLoadable_Load() does not return).  Then when you complete the download, the application program should start automatically (the LED will flash at a slower rate) and if you enter a question mark on the Coolterm window, you should again see a list of commands.

   

My issue is that this seems to work .... sometimes.  It does not work each time.  The host bootloader window shows that it finished the downloady successfully, but the LED remains blinking at the fast rate and entering commands such as a question mark on the Coolterm/TeraTerm window would only show a checkmark.

   

The attached images show the Host Bootloader utility's window after downloading the application, but the LED is still flashing at the faster rate as well as the TeraTerm window when I entered a ? after the download.  I'm guessing that the checkmark is the bootloader saying it didn't understand the question mark because the application has not been executed.

0 Likes
Anonymous
Not applicable

Another update:  I changed the application code so that instead of calling Bootloadable_Load(), it modifies the application code's checksum stored in the metadata in flash, then did a Cy_SoftwareReset().  Unfortunately, the results are the same.  Sometimes after the Host Bootloader utility completes the download, the bootloader properly jumps to the application, and sometimes it does not.  If I manually press the reset button on the development board, the bootloader executes, validates the application and jumps to the application.  

   

Thinking that maybe this is a development board "feature", I tried the above on one of our target boards and had the same results.

   

This last test seems to vindicate the Bootloadable_Load() logic.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

And another update:  I used the debugger to attach to the bootloader when it did not pass control to the application.  I found that it was stuck in the method, "Bootloader_HostLink" waiting for another command from the Host Bootloader utility. At this point, the Host Bootloader Utility has already displayed the message that  the program Finished Successfully and displayed the amount of time it took to complete the programming process.  I then added some debug information which saved the last 20 commands received from the host in a circular buffer, placing the sentinel, 0xBD after the last command received..  When I repeated the test again, I again attached to the bootloader and dumped the contents of the buffer. See the attached image.  The last command that was received was a 0x3A "Get row checksum" command.  I would have expected to see a 0x3B "Exit" command, The code to capture the command is:

   

 

   

            uint8 CYDATA btldrData = packetBuffer[Bootloader_DATA_ADDR];

   


dagReset[resetIdx%20] = packetBuffer[Bootloader_CMD_ADDR];
resetIdx = (resetIdx>=19)?0:resetIdx+1;
dagReset[resetIdx]=0xBD;

   

 

   

            ackCode = Bootloader_ERR_DATA;
            switch(packetBuffer[Bootloader_CMD_ADDR])

   

Could there be some sort of timing issue where the bootloader utility doesn't wait long enough for a response from the bootloader?

   

Thanks

   

Dave

0 Likes
AnkitaS_51
Employee
Employee
100 likes received 50 likes received 25 likes received

Use higher UART speed >=115200 bd for bootloading ,then you will not observe this issue.

0 Likes
Anonymous
Not applicable

The UART speed is already 115200.

   

 Is there any way to get the source for the host bootloader utils NativeCode?  If so I can debug the issue on both sides.

   

Thanks

0 Likes
AnkitaS_51
Employee
Employee
100 likes received 50 likes received 25 likes received

At this link ,you can find the Bootloader host older version source code with the Application Note-

   

http://www.cypress.com/documentation/application-notes/an68272-psoc-3-psoc-4-psoc-5lp-and-psoc-analo...

   

​I can't provide you with the native code of latest version of Bootloader Host utility.Sorry for the inconvienience.

   

This is a known issue which you have reported,are you observing this issue even with baud rate >=115200.

0 Likes
Anonymous
Not applicable

Yes. I am using 115200 and still have the problem when I use the bootloader host utility from the Tools drop down.  I don't seem to have an issue if I built the example UART Hostbootloader project.

0 Likes