3 Replies Latest reply on Sep 18, 2014 10:43 AM by initium

    DCT write to application section

    initium

      With the newly released SDK 3.1, it appears that the old DCT read/write functions have been deprecated.  However, I'm seeing issues with the new functions when writing to the application section.  I'm not able to read a previously written value in the application section.

       

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

      p_test->test = 2;

      wiced_dct_write( (const void*) p_test, DCT_APP_SECTION, 0, sizeof(some_struct_t) );

      wiced_dct_read_unlock( p_test, WICED_FALSE );

       

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

      WPRINT_APP_INFO(("Rereading test ID after write=%ld\r\n", (long int)p_test->test));

      wiced_dct_read_unlock( p_test, WICED_FALSE );

       

      I see "Rereading test ID after write=-1" on the UART.

       

      Can someone from the WICED team please see if there is an issue with the above code and if it should have been working.

       

      Thanks.

        • 1. Re: DCT write to application section
          initium

          Making the second parameter of wiced_dct_read_lock and wiced_dct_read_unlock functions from FALSE to TRUE gets things working,  Still not clear on the reason.

           

          Thanks,

          • 2. Re: DCT write to application section
            seyhan

            Hi,

             

            There has been some changes for storing and retrieving DCT data from SDK-2.4.1 to SDK-3.1.0.

            Please check the header file or documentation for the APIs for more information.

             

            Here is the functions parameter as follows:

            /** Reads the DCT and returns a pointer to the DCT data

            *

            * The operation of this function depends on whether the DCT is located in

            * external or internal flash memory.

            * If ptr_is_writable is set to false and the DCT is located in internal flash,

            * then a direct pointer to the flash memory will be returned.

            * Otherwise memory will be allocated and the DCT data will be copied into it.

            *

            * @note : this function must be used in pairs with wiced_dct_read_unlock to

            *         ensure that any allocated memory is freed.

            *

            * @param info_ptr [out] : a pointer to the pointer that will be filled on return

            * @param ptr_is_writable [in] : if true then then the returned pointer will be in RAM

            *                          allowing it to be modified. e.g. before being written

            * @param section [in] : the section of the DCT which should be read

            * @param offset [in] : the offset in bytes within the section

            * @param size [in] : the length of data that should be read

            *

            * @return    Wiced Result

            */

            extern wiced_result_t wiced_dct_read_lock(   void** info_ptr, wiced_bool_t ptr_is_writable, dct_section_t section, uint32_t offset, uint32_t size );

             

            -Seyhan

            1 of 1 people found this helpful
            • 3. Re: DCT write to application section
              initium

              Thanks Seyhan.  I agree, the parameter section does explain it.

               

              Regards.