Hello everybody,

I'm trying to run the BoschXDKCloudConnectivity-demo so I can understand how the FOTA works. 

I have written a config-file on a SD-card so that the application will contact a RaspiPi3.

On the Raspi a Lesham-Server works just like explained in the docs.

 

The connection runs well and I can see the client on the front-end of the server and I can read some information about the client.

 

The problem is I really don't know how to send a new binary file to the client.

I compiled the application on my Win10-machine and I opened the GUI of the server using chrome.

 

I tried to upload the bin-file using the Ressource 5/0/0 with the result:

Unable to write resource /5/0/0 for MY_ENDPOINT_NAME : 400 Invalid request:Unable to convert hexastring [D:\Programs\XDK-Workbench\workspace\XdkApplicationTemplate\debug\XdkApplicationTemplate.bin] to byte array for resource /5/0/0

 

And I tried to upload the bin-file using the ressource 5/0/1 with the result that when I click on execute (5/0/2) the hint shows "Bad request".

 

I have googled a lot, but I didn't find any examples of how to update the software with the lesham-server.

 

At this point any help 'd be appreciated.

 

Thank you (again)

 

Elvys

 

PS Can you explain me when you should use ressource 5/0/0 and when you should use 5/0/1 + 5/0/2. The documentation is really poor about this.

0 (0 Votes)
RE: Can't update the software with the BoschXDKCloudConnectivity demo
Answer
2/7/18 1:37 PM as a reply to Elvys Melo.
Hello Elvys,

in my understanding, the Package URI (5/0/1) must be hosted in a location that is routable from the device that intends to download the binary. I.e., it must be a valid coap:// or http:// address.

The BoschXDKCloudConnectivity example currently only supports coap://. As such, you need to host the XDK binary on a coap-accessible server and the address to the file must be given as coap://www.my-host.net/path/to/file.bin on resource 5/0/1.

Once you update the Package URI, the XDK should start downloading the firmware update and the state on resource 5/0/3 should be updated.

Once the state is 2 (== Downloaded), you can use resource 5/0/2 (Exec) to start the update.

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Alex
0 (0 Votes)
RE: Can't update the software with the BoschXDKCloudConnectivity demo
Answer
2/7/18 2:50 PM as a reply to Alexander Sawtschuk.

Hello Alexander,

as I mentioned above the XDK110 connects itself to a leshan-server, which uses the coa-(protocoll).

The connection works well, and some information can be read.

 

The server-GUI shows the coap-messages send and received.

 

The difference to your example is that I try to upload the bin-file directly from my PC (D:-Drive).

Maybe it this the problem: But how can I upload the file to the server from my PC (where the file is compiled) and than upload it to the client?

I didn't read nowhere that the leshan server has read access to a specific path of the localhost.

 

Thank you for your advices.

 

Regards,

 

Elvys

0 (0 Votes)
RE: Can't update the software with the BoschXDKCloudConnectivity demo
Answer
2/8/18 2:57 PM as a reply to Elvys Melo.

Hello everybody,

 

just an update: I restarted all devices (XDK110 and Raspi) and I have restarted the Leshan-Server.

Just to be sure, the Bootloader has the version V1.1.0. This is also the value I set in the properties of the project (File --> Properties --> XDK Bootloader and Fota)

 

The SW built, is flashed on the SW using the "standard"-way (with the USB-connection).

When I try to flash the same SW using the Leshan-server, now I get following message on the console:

Error in package ID: 26  Severity code: 3 Error code: 88, module ID : 5 
 INFO | XDK DEVICE 1:        646 [EXH:2] M=0x01, E=0x02, S=0x2 (0x0182)

 

Sincerly, it looks to me as I did a step forward but I don't know what this error means.

I found out that there was a similar issues (https://xdk.bosch-connectivity.com/community/-/message_boards/message/295711) but with error code 89.

 

I have tried to found out, what this codes means but without success (The function Retcode_GetCode which returns the error-code just shifts and masks a given value).

 

I hope this new information can make the situation more clear.

 

Thank you in advance,

 

Elvys

 

 

0 (0 Votes)
RE: Can't update the software with the BoschXDKCloudConnectivity demo
Answer
2/8/18 5:27 PM as a reply to Elvys Melo.
Hello Elvys,

as far as I know, the Leshan server does not require to have access to the location where the firmware is hosted. That means, an entirely different server can host the binary, as long as the client can reach the server.

There are example sever implementations for file hosting available:
Via resource 5/0/1, the user can tell the XDK where the new binary can be downloaded from. Once the XDK receives the URI, it will recognize this as a link to the binary and start downloading it automatically (unless the link is invalid or unreachable, of course).

This means, you cannot simply give the directory on your PC as the URI. It will not work simply, and any error that is produced from that cannot be accounted for. The address must lead to a server that is capable of responding via CoAP.

There is also the possibility to write the binary to 5/0/0 directly, using a CoAP PUT request with the binary as the payload (blockwise request with option BLOCK 1).

But, I would first need to test this out myself, before I can make further assumptions and proposals regarding this issue.

For that, could you briefly explain your setup, and what you used to host the Leshan server?

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Alex
0 (0 Votes)
RE: Can't update the software with the BoschXDKCloudConnectivity demo
Answer
2/13/18 5:08 PM as a reply to Alexander Sawtschuk.

Hello Alexander, hello everybody,

 

sorry for my delayed answer, but I had to make my ideas more clear about the topic, so I started to read a lot.

 

My biggest mistake was that I was supposing I can upload the new firmware to the leshan-server and the server forwards it to the client.

According to http://openmobilealliance.org/release/LightweightM2M/V1_0_2-20180209-A/OMA-TS-LightweightM2M-V1_0_2-20180209-A.pdf page 142 and the answers of the other users in this topic this doesn't work like that.

 

Now I set up two different on coap-file-server on my raspberry pi 

  • https://github.com/firmwaremodules/iot-ota-server and
  • https://github.com/msolters/ota-server

both based on nodejs.

To avoid conflicts with the leshan server I used during the tests UDP4 and I changed the port to 6666.

I just copied the file XdkApplicationTemplate.bin to the location where the file-servers expect the files.

 

Unfortunatelly I'm still not able to upload the firmware.

 

The ota-server shown on the console 

Received CoAP request: /XdkApplicationTemplate.bin

which should be right so far but my XDK110 answer with

 

INFO | XDK DEVICE 1: Error in package ID: 26  Severity code: 3 Error code: 73, module ID : 5

A similar behaviour has the other file server.

 

Does anybody know what this means? Or where can I get proper information?

In the file  BCDS_Retcode.h I can interpret that the Severity code is a warning. But I didn't find out what the other codes means.

 

I thank you again for your help.

Regards,

 

Elvys

0 (0 Votes)
RE: Can't update the software with the BoschXDKCloudConnectivity demo
Answer
2/14/18 3:59 PM as a reply to Elvys Melo.
Hello Elvys,

the issue with the error messages is, that the package IDs are not openly visible to user's currently.

I have looked into it, and the error ID refers to FOTA_DL_TIMEOUT from the package SDK > xdk110 > Platform > FOTA. This would mean that the download fails,.

The issue with the download is the fact that you host the file on port 6666, but the standard CoAP port is the same as it is for Leshan. Most likely, the request is sent to the CoAP port and not 6666, which is why the download can not commence.

I would recommend that you first try to insert a different URI that includes the port, i.e. coap://192.168.x.y:6666/XdkApplicationTemplate.bin . Try to leave out the coap:// prefix as well, if that does not work.

The other option would be to host this file on another Raspberry Pi, and to use the standard CoAP port instead.

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Alex
0 (0 Votes)
RE: Can't update the software with the BoschXDKCloudConnectivity demo
Answer
8/29/18 8:59 AM as a reply to Alexander Sawtschuk.

Hello everybody,

 

sorry for the very big delay. I was needed in another project and I didn't have the opportunity to set up the system to test it again.

 

But now I have a little bit more time so I hope we can handle with it.

 

What I hava done so far:

 

On a raspberry pi a Leshan server is running on port 5683 for coap and 5684 for coaps.

On the same machine the demo-app cf-simplefile-server of californium is running (git branch 2.0.x commit#23ceec42) on the ports 5685 and 5686.

 

Furthermore I change the value of MAX_RESOURCE_BODY_SIZE to 524288.

 

Now I can copy the bin file in the folder data and start the cf-simplefile-server (java -jar ...) 

When the XDK110 is connected to the leshan-server (port 5683) I can insert the URI of the package (/5/0/1) using the coap protocol and the proper port.

In my case the uri looks like: coap://192.168.1.1:5685/data/firmware.bin

After the write-process is finished the state changes to 2.

Execute the update (/5/0/2).

 

I hope this can help new beginner in this topic.

 

Thanks to everybody for the help.

 

Regards,

 

Elvys

 

 

0 (0 Votes)
RE: Can't update the software with the BoschXDKCloudConnectivity demo
Answer
8/30/18 3:27 PM as a reply to Elvys Melo.
Hello Elvys,

It has been a while, but it is great to read some updates about your ongoing project.
I am glad to hear about your successful implementation with FOTA on the XDK.

Thank you very much for the detailed explanation about the steps, you proceed to set up the CoAP download server for the XDK application binary. Probably many XDK community members will appreciate it.

Please feel free to ask if you have any concerns or questions and keep us updated.

Kind regards,
Franjo
0 (0 Votes)