4 Replies Latest reply on Oct 12, 2016 6:37 PM by rash

    snip.dct_read_write error

    akolamb1

      Using 3.5.2 SDK

      In dct_read_write.c

       

          WPRINT_APP_INFO( ( "Modifying Single byte in App Section \r\n" ) );
          /* Modify single byte value - test sflash single-byte writes */
          app_dct->uint8_var = 0x22;
          wiced_dct_write( (const void*) app_dct, DCT_APP_SECTION, 0, sizeof(uint8_t) );
      
      
          WPRINT_APP_INFO( ( "Modifying uint32_t value at odd offset in App Section \r\n" ) );
          /* Modify single byte value - test sflash uint32_t on a non-4-byte-boundary writes */
          app_dct->uint32_var = 0x22;  
          wiced_dct_write( (const void*) app_dct, DCT_APP_SECTION, 0, sizeof(uint32_t) );
      

       

       

      The assignment app_dct->uint32_var = 0x22 does not seem to work.

      I printed the value right after the assignment and it does not show up correctly (the value still shows up as 99999999 )

       

      Not able to figure out why.

       

      Also the variable definition earlier on in the file is incorrect.

      CONFIG_UINT32_DATA and CONFIG_UINT8_DATA are swapped.

      But correcting this did not help either.

       

      static const configuration_entry_t app_config[] =
      {
          {"uint8_var ", DCT_OFFSET(dct_read_write_app_dct_t, uint8_var ),  4,  CONFIG_UINT32_DATA },
          {"uint32_var", DCT_OFFSET(dct_read_write_app_dct_t, uint32_var),  4,  CONFIG_UINT8_DATA },
          {"string_var", DCT_OFFSET(dct_read_write_app_dct_t, string_var), 50,  CONFIG_STRING_DATA },
          {0,0,0,0}
      };
      
        • 1. Re: snip.dct_read_write error
          rash

          Can you use the following snippet for assigning the values and check for the issue

           

          strcpy( app_dct->string_var, modified_string_var );

                    /* Modify single byte value - test sflash single-byte writes */

          app_dct->uint8_var = 0x22;

                   /* Modify single byte value - test sflash uint32_t on a non-4-byte-boundary writes */

          app_dct->uint32_var = 0x22;

          wiced_dct_write( (const void*) app_dct, DCT_APP_SECTION, 0, sizeof(dct_read_write_app_dct_t) );

           

           

          wiced_dct_read_unlock( app_dct, WICED_TRUE );

              /* Print modified string_var */

          wiced_dct_read_lock( (void**) &app_dct_modified, WICED_FALSE, DCT_APP_SECTION, 0, sizeof( *app_dct_modified ) );

              WPRINT_APP_INFO( ( "Modified string_var: %s\r\n", app_dct_modified->string_var ) );

              WPRINT_APP_INFO(("\r\n %ld  ................", app_dct_modified->uint32_var ));

          • 2. Re: snip.dct_read_write error
            rash

             

             

             

            You need to write the data for the whole size not for single entity.

            1 of 1 people found this helpful
            • 3. Re: snip.dct_read_write error
              axel.lin_1746341

              rash wrote:

              You need to write the data for the whole size not for single entity.

              No, it's fine to write single entity with proper offset.

              • 4. Re: snip.dct_read_write error
                rash

                axel.lin I too mean the same. The size of the wiced_dct_write should be for whole dct_read_write_app_dct_t structure size but not a single entity size.

                 

                Yes, you are right it fine to write single entity with proper offset.