Forums - CSRB534x OTA

8 posts / 0 new
Last post
CSRB534x OTA
sujata
Join Date: 31 Aug 16
Posts: 5
Posted: Mon, 2016-09-05 09:04

HI all,

I am trying to implement the OTA update for CSR534x chip. I am trying with CSR Dev board.

Is there any example application source code from CSR which shows how the CSRb534x module will receive the new binary file. Source code which makes use of "StreamPartitionOverwriteSink()", "PartitionSetMessageDigest()", "PsStoreFsTab()" APIs.

I am referrring the SQIF-Partitioning guide and OTA example application guide (CS-326127-AN1 and CS-323516-AN2) from CSR. Is there any other documentation explaining the OTA of CSRB534x?

Thanks in advance.

  • Up0
  • Down0
jonesm
Join Date: 13 Jun 16
Posts: 79
Posted: Thu, 2016-09-22 10:19

Those are the correct documents to look at. Qualcomm currently does not have plans to release example source code as Qualcomm does not want to limit the number of ways a customer could get the upgrade data to the CSRB534x, e.g. SPP, wired, etc.

  • Up0
  • Down0
sujata
Join Date: 31 Aug 16
Posts: 5
Posted: Fri, 2016-09-23 03:34
Hi Jonesm,
 
Thanks for reply.
 
I am going through the documents again and again and trying to clear the concepts, but feel that those are not sufficient and need more clarification (either thorough document or through code). 
 
Our modules main application is to support SPP profile. I am implementing functions to download the upgrade file over SPP connection from remote device. Previous to run the code to receive the upgrade file, I partition the SQIF to make sure that it is having one unmounted partition to write upgrade image. 
 
The docuemnt mentions "The target device may accept an update at any point or there may be a special mode for this operation. The currently running application will need to detect the update request and act as required to perform the update." When my device is receiving data from remote device how it will know that this is the data for upgrade or noraml data, Is there any API that HOST should call or any API that module should call locally before writing data to this partition?
 
For test purpose, I assume the data sent is only upgrade file and remote dev sends only upgrade file to my device once connected. In code, when my module gets connected and starts receiving data, I am calling "StreamPartitionOverwriteSink" API and mentioning the partition to write the data. but I get error as Sink is not valid (API returns "Sink" if partition found and erased successfully, otherwise NULL). This was the very first step I was failing so could not executre the next steps. Please mention the step I am missing or guide me to follow the correct way. 
 
Also you have mentioned, "upgrade data to CSRB534x e. g. SPP, wired etc." Is it possible to update the CSRb534x over DFU-USB or DFU-UART? If yes, please mentione the docuemnts providing this upgrade method. (We provide DFU-USB/DFU-UART with BC04/BC05. forCSRB534x as VMcode is in external memory and stack xpv/xdv mnot supported I hope the way to produce the final production image is different).
 
I await your reply. 
 
Regards, 
Sujata
  • Up0
  • Down0
jonesm
Join Date: 13 Jun 16
Posts: 79
Posted: Tue, 2016-10-25 11:13

You can add a header to the upgrade file so your application can differentiate between an upgrade file and regular SPP data. This is one way to go about it if you do not want user interaction. Can you provide a snapshot of your code that is using StreamPartitionOverwriteSink() so I can see if I can spot anything wrong. What may also be useful to see is the partition file you are using. You want to use RS for the partition type. It is possible to upgrade over a wired input, e.g. USB or UART. However, the same process used for BC04/05 cannot be used. You will need to develop an application that takes data from USB or UART and copies it to SQIF.

  • Up0
  • Down0
sujata
Join Date: 31 Aug 16
Posts: 5
Posted: Wed, 2016-11-23 02:50

Thanks for the reply.

Menatime I came across a document  "CS-227835-AN-4-Using external FLASH on ADK.pdf" under CSR8670 docuemntation. I found this document useful for implementing the code for OTA of CSRB534x but this document is not mentioned anywhere in CSRB534x SDK or related documentation to refer for the OTA implementation. 

With the help of above document, I succeeded to write the partition with image-file received from remote device over BT connection.

There are two issues:
1.  SQIF message handler:
  I created the SQIF message handler. I was expecting the SQIF-task to receive message "MESSAGE_MORE_SPACE" after creation of Partition Sink and while receiving the file from Remote device. But I receive "MESSAGE_MORE_SPACE" message to my main-application-task instead of SQIF-task.
I would like to ask is it advisable to refer the "CS-227835-AN-4-Using external FLASH on ADK.pdf"  for CSRB534x?
Without hitting above message I can write a 4KB file to partition, but I am not sure whether I can write large application image?
  
2. Creation of Binary file from image.fs
I managed to implement the code on CSRB534x module to receive the file and write it to the partition successfully. I tried this with the "update_1.fs" file generated after signing the "image.fs" with the private key.
I am not using "PartitionSetMessageDigest()" with NULL option skipping the verification.
Documentation mentions to send the raw binary file. But I don't know how to generate  raw binary file after signing the image.fs with Private key. Can anyone provide reference document or script to create the binary image? Has anyone managed to get the OTA functionality working on CSRB534x module?
 
I hope to see some reply.
 
Thanks for your time.
 
Regards,
Sujata
  • Up0
  • Down0
sujata
Join Date: 31 Aug 16
Posts: 5
Posted: Wed, 2016-11-23 03:31
 To be more specific about the bianry image I would like to provide more information.
 
 The final file which I am tranferring on BT connection is created from image.fs with Below steps:
 
 1. create the Image.fs 
 2. Create the OTA-File by signing the image.fs with private key "private.key" file 
C:\CSRB534X_SDK-1.0.6-Release\tools\bin\dfusign.exe -o OTA_File_1 -h image.fs -ka testing_dfu_sign.private.key
 3. Generates the "OTA_File_1.fs"
 
 Above "OTA_File_1.fs" looks like this (I am only blinking the LEds in this file for simplisity).
"
#!TRAP_INFO 0 PioSetDir32
#!TRAP_INFO 0 exit
#!TRAP_INFO 22 LedConfigure
#!TRAP_INFO 24 NativePauseForDebug
@000000   7366
@000001   5F72
@000002   6664
@000003   3175
@000004   6200
 .
 .
 .
 .
@00011C   0000
@00011D   00DA
@00011E   4669
@00011F   6C65
"
 
 
When this fiel is transferred over BT connection and written to partiotion. I read my flash memory with nvscmd tool in PTN file.
The .PTN file I get from the flash is as below:
"OTA_TEAT_READ_FLAH.PTN" is as below:
This is nothing but the Ascii of the image transferred. 
"
@000000   2321
@000001   5452
@000002   4150  #41 50 5f 49 4e 46 4f 20 30 = AP_INFO "
@000003   5F49
@000004   4E46
@000005   4F20
@000006   3020
@000007   426F
@000008   6F74
@000009   4765
@00000A   7450
@00000B   7265
@00000C   7365
@00000D   7276
@00000E   6564
@00000F   576F
@000010   7264
@000011   0D0A
@000012   2321
@000013   5452
@000014   4150 #41 50 5f 49 4e 46 4f 20 30 = AP_INFO "
@000015   5F49
@000016   4E46
@000017   4F20
@000018   3020
@000019   5069
@00001A   6F47
@00001B   6574
@00001C   3332
@00001D   0D0A
@00001E   2321
.
.
.
.
.
@000927   0D0A
@000928   4030 "40 30 30 = @000 "
@000929   3030
@00092A   3131
@00092B   4520
@00092C   2020
@00092D   3436
@00092E   3639
@00092F   0D0A  
@000930   4030   "@00011F   6C65"
@000931   3030
@000932   3131
@000933   4620
@000934   2020
@000935   3643
@000936   3635
@000937   0D0A
 
  • Up0
  • Down0
jonesm
Join Date: 13 Jun 16
Posts: 79
Posted: Wed, 2016-12-28 14:24

To create a binary output file, you can use python and do something similar to: f_out = io.open(sys.argv[x], "wb") - where x is the argument number passed in to the python script.

  • Up0
  • Down0
sujata
Join Date: 31 Aug 16
Posts: 5
Posted: Wed, 2017-01-04 09:22

Thanks for inputs.

I will try this and update you..

Regards,

sujata

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.