4 Replies Latest reply on Jul 19, 2020 7:25 PM by YaSe_4616256

    API "wiced_dct_write" returns WICED_ERROR on CYW943907AEVAL1F

    YaSe_4616256

      Hello,

       

      I'm using CYW943907AEVAL1F and WICED studio 6.4.
      And I'm developping DCT write program with refering example named dct_read_write.c in folder "43xxx_Wi-Fi\apps\snip\dct_read_write".
      But when it calls the API "wiced_dct_write", it returns WICED_ERROR.

       

      <My question>
      Can you please help me to solve this problem?


      <My conserning>
      I used WICED studio debugger, and confermed where "wiced_dct_write" is defined.
      And I understoodd it was defined in wiced_dct_external_common.c in folder "WICED-Studio-6.4\43xxx_Wi-Fi\WICED\platform\MCU".
      And I also inspected the reason of the error which is returned from above API "wiced_dct_write". The following are the details.

       

       

      ======= wiced_dct_external_common.c  =================================================================================
      *line: 174
          static const uint32_t DCT_section_offsets[] =
          {
              [DCT_APP_SECTION]             = sizeof( platform_dct_data_t ),

       

      Note: sizeof( platform_dct_data_t ) is 8000.

       

      *line: 1582
          wiced_result_t wiced_dct_write( const void* data, dct_section_t section, uint32_t offset, uint32_t data_length )

       

      Note: passed parameters from my caller function contain the following values in this stage.

          section     :0(DCT_APP_SECTION)
          offset      :0
          data_length :11196

       

      *line: 1589
          uint32_t                section_start = DCT_section_offsets[ section ];

       

      Note: DCT_section_offsets[] has the following values in this stage.

              DCT_section_offsets[0]          8000            DCT_APP_SECTION
              DCT_section_offsets[1]          8000            DCT_HK_INFO_SECTION
              DCT_section_offsets[2]          544             DCT_SECURITY_SECTION
              DCT_section_offsets[3]          388             DCT_MFG_INFO_SECTION
              DCT_section_offsets[4]          6704            DCT_WIFI_CONFIG_SECTION
              DCT_section_offsets[5]          0               DCT_INTERNAL_SECTION
              DCT_section_offsets[6]          7548            DCT_ETHERNET_CONFIG_SECTION


      line: 1602
          /* Check if the data is outside the bounds to write */
          if ( (section_start < sizeof(platform_dct_header_t)) ||
                   ((section_start + offset + data_length) > platform_dct_copy1_size))
          {
              return WICED_ERROR;
          }

       

      Note: the section_start and sizeof(platform_dct_header_t) match to the following values.

              section_start                   :8000(0x1f40)
              sizeof(platform_dct_header_t)   :388(0x184)
      =====================================================================================================

       

      Since DCT_section_offsets[DCT_APP_SECTION] is initialized with 8000, the condition "(section_start < sizeof(platform_dct_header_t))" will be always true.
      Therefore the API "wiced_dct_write" will return WICED_ERROR.

        • 1. Re: API "wiced_dct_write" returns WICED_ERROR on CYW943907AEVAL1F
          MuraliR_36

          Hello YaSe_4616256

           

          Since DCT_section_offsets[DCT_APP_SECTION] is initialized with 8000, the condition "(section_start < sizeof(platform_dct_header_t))" will be always true.

          --> The section_start as you pointed out has a value of 8000 and the sizeof(platform_dct_header_t) isn't that big. It returns around 388 bytes by default. Not sure as how to how the sizeof(platform_dct_header_t) came as 8000.

           

          I think that you are getting a WICED_ERROR because of the data length. By default the DCT can have an app section of 8KB. But the data length that you are reporting is 11196. Try reducing this to below 8KB and it should work.

           

          If compromising on the data size is not an option, then Application DCT changes on reset this thread has some insight on how to increase the DCT size.

           

          Thanks

          • 2. Re: API "wiced_dct_write" returns WICED_ERROR on CYW943907AEVAL1F
            YaSe_4616256

            Dear MuraliR_36,

             

            Thank you for your reply. With your help, I was able to notice my misunderstanding.
            As you pointed out, the reason for the error was that the data size was too large.

             

            (Details)
            I've recheck the following condition using WICED studio debugger, and found my misunderstanding.

             

                if ( (section_start < sizeof(platform_dct_header_t)) ||
                         ((section_start + offset + data_length) > platform_dct_copy1_size))

             

            The first condition "(section_start < sizeof(platform_dct_header_t)" always become false.
                 * In my first question, I misunderstood it became true. Sorry.

            So the second condition "(section_start + offset + data_length) > platform_dct_copy1_size)" was always evaluated as true.

             

            Temporary, I have been reduce the data size, and the error was solved. Thank you.

             

             

            (Additional question)
            As a permanent measure, I'm wondering if I should increase the size of the DCT or write directly to the free space of sflash without using the DCT. So I have additional question.
            On CYW943907AEVAL1F, can I write more large data to sflash flee area which is not managed by DCT ?
            If I can, could you please inform the related technical document or web page?

             

            Best Regards,

            • 3. Re: API "wiced_dct_write" returns WICED_ERROR on CYW943907AEVAL1F
              MuraliR_36

              Whether DCT needs to be increased or the sflash should be made use of depends on your use case to be frank. If you have critical data needed by the device then its better to make use of the DCT.

              This blog post should give you insights on how to write to specific area of sflash, read and erase them How to use sflash_write.tcl script embedded in WICED?

              1 of 1 people found this helpful
              • 4. Re: API "wiced_dct_write" returns WICED_ERROR on CYW943907AEVAL1F
                YaSe_4616256

                Thank you for providing additional information.

                After confirmation, I'll consider the next step.