OTA Fixed Stack

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

cross mob
Anonymous
Not applicable

Hello,

I am working its PSOC 3.3 creator, SP 2.

The chip I am using is CYBLE 222014-00, Proc BLE family.

In the last 2 weeks, I am trying to integrate the OTA Fixed stack bootloader (ver. 1.30) into my project.

But, unfortunately, I encouraged few problems.

First I will explain my scenario –

I would like to move from my application in the boot loader by Application command because I don’t have switch buttons on my board. So, I have added new command to support it.

While it's in the bootloader, I would like it to stay there until bootloader host command is received. But, if the bootloader didn’t receive host command so after 1 minute it's jump to the boot-loadable application.

Of course, I decided to work with the "wait for command" option.

I found few problems:

1. The time is limited to 25.5 seconds (for my application its short).

2. When I choose wait_for_command (wait 25 seconds),

The code that was actually executed was: "wait for ever " in line 1088

Instead of: wait for command in line 1095

I read in the forum (https://community.cypress.com/message/45740#45740)

To change input parameter in line 1088 to "Bootloader_WAIT_FOR_COMMAND_TIME"

But it caused me to infinite resets in the bootloader application.

3. Also, I think there is a bug with calculating the timeout and actually it is divided by 10 so the maximum time is 250 mSeconds.

When I am writing on the wizard 25000 it is converted to 250 (100mSec resolution).

In Bootloader_HostLink() the read() from the BLE is executed 10 times.

Read is done by the CyBLE_CyBtldrCommRead().

In this function, the time is converted from 10mSec to 100uSec resolution.

/* Convert from 10ms units to 100us units */

timeoutUs = ((uint32) 100u * timeOut);

See the calculation bellow:

10 (the loop) * 250 (bootloader.h) * 100 (conversion from 10mSec to 100uSec) = 250,000 = 250 mSec 

So, it's waits 250mSec instead of 25 seconds.

Did I miss something?

4. I moved to wait_for_ever option, but now, it is stuck in the boot and not jumping to the application even though there is a valid application in the flash.

I would appreciate a quick response because it is urgent.

Thanks, Avi

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

I just tried to stop bootloading around 70% and it jumps back to bootloader project. Two_Projects.pngBootloading_forced_to_stop.pngAfter_disconnect.png.

View solution in original post

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

1.  For wait time beyond 25.5 S, you can use custom timing implementation such as, a message from the host or timer interrupt flag after say x Seconds. Later, call Bootloader_Start() with zero wait time.

2. Please confirm how the control is given to bootloader. If the bootloader is called from bootloadable via Bootloadable_Load() API, it assumes that a firmware is ready to bootload and waits forever. However, power on reset/hard reset can pass control to bootloadable. User needs to exert caution while calling Bootloadable_Load(). Another alternative is to implement custom exit function inside source file instead of waiting forever.

3. Please confirm whether you are facing any issues with a wait time of 25S upon power on reset. Also, please use latest bootloader component v1.60.

4. This behavior is expected. For better understanding on bootloader flow, please refer to figure in page no: 37 in bootloader component datasheet.

0 Likes
Anonymous
Not applicable

1. so, in the wizard i should set the wait time to 0, then to use a custom timer.

    right now, i am using the advertising timeout to switch to the loadable application by using CySoftwareReset() .

is that ok?

2. the control is given to the bootloader by the bootloadble application using Bootloadable_Load(), the same as your code example.

    

3. where csn i find the latest version? and do you think its will work correctly with psoc creator 3.3 (SP 2)?

4. so, if i will use wait_for_ever option, but implement custom timer (i am using the advertisement timeout). then, in the timeout i should call Bootloader_Start() in order to jump to my valid bootloable application?


another issue,


i need to implement host side which handle the image download procedure. my question is where can i find the flowchart of this procedure ?starting from the connection, download the image and test validity.

i saw in the document you have linked here, the commands and their structures but i missed the flow of this procedure.

things like what is the right order? What should i check before moving forward to next step and so on.


Thanks, Avi 

 

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

(1) Which API are you using to schedule/start bootloadable application upon advertising time out?

(2) In that case, bootloadable will wait forever for new firmware download.

(3) Please install latest PSoC Creator with revised bootloader and bootloadable versions from http://www.cypress.com/products/psoc-creator-integrated-design-environment-ide. To update components in PSoC Creator, goto Project > Update Components

(4) If you select wait forever option and call bootloader_Start() API, it will wait forever in the bootloader regardless of bootloadable application validity. Suppose you are using custom timing, wait for command is not necessary. Once advertisement is timed out, please call Bootloader_Start() with no wait time and bootloadable will be loaded straight away.

Please refer to http://www.cypress.com/documentation/application-notes/an97060-psoc-4-ble-and-proc-ble-over-air-ota-...  for OTA details and corresponding code example documents available in PSoC Creator for firmware flow.

0 Likes
Anonymous
Not applicable

1. that's what i am doing in the advertising timeout:

if (CYRET_SUCCESS == Bootloader_ValidateBootloadable(0))

{

DBG_PRINTF("jump to loadable App...\r\n");

Bootloader_SET_RUN_TYPE(Bootloader_SCHEDULE_BTLDB);

CySoftwareReset();

}

else

{

DBG_PRINTF("reset and stay in bootloader...\r\n");

Bootloader_Exit(Bootloader_SCHEDULE_BTLDR);

}

2. OK

3. i prefare not to use latest psoc creatore, right now, can use newer

bootloader version with psoc3.3?

4. i will try it. but the question is what if there is no valid

bootloadable application? should check the valiidy before (just like i did)?

the link you have sent me not includes the programming flow from the host

prespective.

On Mon, Nov 2o 6, 2018 at 11:38 AM geon <community-manager@cypress.com>

0 Likes
Anonymous
Not applicable

i did several tests and i found unexpected behavior.

i wanted to test what will happen if i stop the BLE connection during the image download, i expeced the boot-loadable application to be invalid so, after reset, we will stay in bootloader. but, what was actually happen, was that the bootloader run my old boot-loadable application.

(just to remind you - it is fixed stack OTA implementation)

the question is how can it be?

(i did it twice and saw the same behavior)

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

In what stage was the BLE disconnected/stopped while bootloading? Please share CySmart screen shot to understand the bootloading stage. Also, please confirm how is the BLE connection stopped.

0 Likes
Anonymous
Not applicable

it was something like 70% of the bootloadable programming.

if you want i can send you screenshot of the CySmart (and UART) later.

thanks, Avi

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

hello geon,

how are you?

attached a screenshot of the cySmart.

i stopped the FOTA procedure twice, in the first time, I stopped the BLE of

my cellphone.

in the second time, i just stopped the download by pressing stop button in

cySmart mobile application.

please advice me, because i was expecting it to jump the bootloader and

stay there.

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

I just tried to stop bootloading around 70% and it jumps back to bootloader project. Two_Projects.pngBootloading_forced_to_stop.pngAfter_disconnect.png.

0 Likes