13 Replies Latest reply on Nov 13, 2018 10:24 AM by lodic_3235181

    UART DFU and Length Error

      Hi All,

       

      working with the CYBLE222014-01 and trying to get DFU over UART using an external micro controller. I've been trying to implement the HOST side code from AN68272 into my own micro controller.

       

      My current process is to send the EZ-serial command to reboot the module into UART DFU mode, which I believe it occurring successfully. After that I utilize the BootloadStringImage function. I generate my string using the included string generator in AN68272.

       

      I believe the process starts out okay, but I seem to be running into issues now where in the main loop that's supposed to extract each row of the string image, I come across error 0x4003, which has to do with the size of the data? The comment in the code isn't very clear what this error means though. Any ideas?

        • 1. Re: UART DFU and Length Error
          GeonaP_26

          Bootloader_ERR_DATA is generated when the data is not of the proper form. Please share the command log. Which command is triggering this error?

          • 2. Re: UART DFU and Length Error

            Hi geon,

             

            the error seems to occur when the host tries to send the first line of the .cyacd file. I am trying to update to FW 1.1.1 on my cyble222014-01.

             

            The first line of the .cyacd is as follows:

             

            ":0001EE01000080002011EE0100B9770200B977020008B5024B83F3088808F0ECFC00800020F8B572B600248022764D211CD2002C6075480AF0A3FA8022211C7448D2000AF09DFA211C724FFF20CA596300161C86431040241862001C3701330132FB18BA18934206D0581E00781F78801907700233F6E704311C29E5D1664A674B14391A60664A674B67481A609923674A1B041360664A674E1160674A674F11609021674AC9051360664A002411603C21654A1360654A1360654A13788B4328390B431370634A023113780B431370E022614B62491A60FC22614B12041A602023604A136060220A605F4908605F490A60C4215F4A890213605E4A11605E4A01211360012284"

             

            In CyBtldr_ProgramRow() function, the problem seems to come up when it gets to the last section of the row data.

            • 3. Re: UART DFU and Length Error
              GeonaP_26

              Can you share the log of command and response packets over UART? This will help us to confirm whether the packet is in proper form.

              • 4. Re: UART DFU and Length Error

                Does the host code have some sort of automatic logging functionality? Or will I need to implement this myself?

                • 5. Re: UART DFU and Length Error

                  I've added some debug code to my micro controller. Currently this is what I'm seeing when I start the bootloadstringimage function. I've also attached the string converted .cyacd file I'm utilizing.

                   

                  Byte written: 0x1

                  Byte written: 0x38

                  Byte written: 0x0

                  Byte written: 0x0

                  Byte written: 0xc7

                  Byte written: 0xff

                  Byte written: 0x17

                   

                  Byte Received: 0x1

                  Byte Received: 0x4

                  Byte Received: 0x0

                  Byte Received: 0x0

                  Byte Received: 0xfb

                  Byte Received: 0xff

                  Byte Received: 0x17

                  Byte Received: 0x1

                  Byte Received: 0x4

                  Byte Received: 0x0

                  Byte Received: 0x0

                  Byte Received: 0xfb

                  Byte Received: 0xff

                  Byte Received: 0x17

                  Byte Received: 0x1

                   

                  Byte written: 0x1

                  Byte written: 0x3b

                  Byte written: 0x1

                  Byte written: 0x0

                  Byte written: 0x0

                  Byte written: 0xc3

                  Byte written: 0xff

                  Byte written: 0x17

                   

                  Everything seems to get stuck at this point...

                  • 6. Re: UART DFU and Length Error
                    GeonaP_26

                    You can use anlyser to log communication packets. 0x3B is Exit Bootloader command which is not acknowledged. Please share the bootloader project to recreate the issue at our end. Meanwhile, are you facing any issues with normal UART application at same baud rate?

                    • 7. Re: UART DFU and Length Error

                      I will share code shortly.

                       

                      As far as UART application... I'm using baud of 115200 currently. This speed works fine with EZ-serial application. Should it be different when in DFU mode? The ez-serial application note says to use 115200 when in DFU mode.

                      • 8. Re: UART DFU and Length Error
                        GeonaP_26

                        You can use a baudrate of 115200. Meanwhile, please confirm whether you face this issue at other baudrates.

                        • 9. Re: UART DFU and Length Error

                          I will try out different baud rates and return with the results.

                           

                          Out of curiosity, does it matter if I update the stack as well as the app? The reason I ask this is because I tried to upgrade the app of one module OTA, and it seems to be stuck in some unknown state now. However when I tried to update OTA the stack and the app, it seemed to work properly?

                           

                          Do I need to update the stack first before the app perhaps? And if so, how would I go about doing that if I'm doing the update via UART?

                           

                          Again for reference, I'm trying to update modules with app 0x1000225.

                          • 10. Re: UART DFU and Length Error
                            GeonaP_26

                            Please confirm whether you are using, Upgradable Stack OTA configuration. If yes, Application Upgrade can be done in single step. There is no need to update stack project.

                             

                            Whereas for stack application firmware update, user needs to update both stack and application projects. Please refer to section: 4.3 Upgradable Stack OTA Bootloader of AN97060

                             

                            Could you explain more details regarding your system? What is the dataflow for new firmware upgrade?

                            • 11. Re: UART DFU and Length Error

                              Hi geon,

                               

                              I'm not entirely sure what you mean by configuration? To reiterate what I'm trying to do. Using an external micro, I'd like to update the app version of my CYBLE222014-01 via UART from . I've been trying to use the example host code provided in AN68272, but I am running into the aforementioned issues.

                               

                              As an experiment, I tried to update the module OTA. Initially I just tried to update the app with this method, but it has left my one module in an unknown state. I tried the OTA on another module, this time also updating the stack, and it seems to have worked.

                               

                              Therefore I'm wondering if for the UART update, I need to upgrade the stack as well as the app, and if this is the case, how do I do both via UART?

                              • 12. Re: UART DFU and Length Error
                                GeonaP_26

                                Are you using dual bootloadable architecture? Please share the workspace to understand the bootloader and bootloadable project configurations.

                                • 13. Re: UART DFU and Length Error

                                  Hi Geon,

                                   

                                  I'm still trying to figure out how best to share my workspace with you. I'm not currently at liberty to share my whole project.. Is there a way to do it privately?

                                   

                                  Otherwise, I've essentially just integrated the boot loader host code from AN6872, only modifying the UART section so that it works with the UART of my ST micro controller.

                                   

                                  Two questions:

                                   

                                  1) Can I update the stack the same way I would update the app?

                                  2) When comparing the string image in the original AN6872 example with my string image that I generated using the string image generator, it seems that my string image has a row length more similar to PSoC3 image, than PSoC4... Could this be a problem?