- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Hi, i'm using WICED-Studio-6.2 & CYW43438A1 for my project, it works fine and ready for mass production now.
For some reason, i need to pre-burn a 4 bytes vendor specific data to the OTP region which could be read back in my program.
wl cisdump before burn:
With reference of "OTP Programming and NVRAM Development in SDIO Mode .pdf" , i burned
some bytes to 2 modules with command: wl cisupdate xx xx
wl cisdump after burn of (modue_1):
wl cisdump after burn (module_2):
My question is : How can i read the data back in my program ? I tried wwd_wifi_get_iovar_value with tag string like "vendid" or "customvar1" , but both failed.
Thanks!!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is a provision to pass length parameter in cisdump to dump particular bytes but it is not working.
As a workaround, we can modify cisdump function and print only the contents which are required. Please refer the attached file for wlu_cisread_offset() function which takes the offset and no. of bytes as argument and prints the data. You can copy the same data into a buffer and access it in your application
static int
wlu_cisread_offset(void *wl, cmd_t *cmd, char **argv)
{
#if defined(_CFE_)
return CFE_ERR_UNSUPPORTED;
#elif defined(_HNDRTE_) || defined(__IOPOS__)
return 0;
#else
char *bufp, *endptr;
int ret = 0;
uint32 off;
uint32 updatelen;
uint32 i;
cis_rw_t cish;
UNUSED_PARAMETER(cmd);
/* validate arg count */
if (!*++argv || !argv[1])
return BCME_USAGE_ERROR;
/* grab byte offset */
off = (uint32)strtol(argv[0], &endptr, 0);
if (*endptr != '\0')
return BCME_USAGE_ERROR;
updatelen = (uint32)strtol(argv[1], NULL, 0);
fprintf(stderr, "number of digits to be read:%d and offset:%d\n", updatelen, off);
/* check for a length argument */
if (updatelen & 1) {
printf("Invalid byte count %d, must be even\n", updatelen);
ret = BCME_BADARG;
goto done;
}
/* Prepare the read info */
cish.source = 0; cish.byteoff = 0; cish.nbytes = 0;
/* set up the buffer and do the get */
memset(buf, 0, WLC_IOCTL_MAXLEN);
strcpy(buf, "cisdump");
bufp = buf + strlen("cisdump") + 1;
memcpy(bufp, (char*)&cish, sizeof(cish));
bufp += sizeof(cish);
ret = wl_get(wl, WLC_GET_VAR, buf, (int)((int)(bufp - buf) + (SROM_MAX)));
if (ret < 0) {
fprintf(stderr, "Failed cisdump request: %d\n", ret);
goto done;
}
/* pull off the cis_rw_t */
bufp = buf;
memcpy((char*)&cish, bufp, sizeof(cish));
cish.source = dtoh32(cish.source);
cish.byteoff = dtoh32(cish.byteoff);
cish.nbytes = dtoh32(cish.nbytes);
/* move past to the data */
bufp += sizeof(cish);
printf("Source: %d (%s)\n", cish.source,
(cish.source == WLC_CIS_DEFAULT) ? "Built-in default" :
(cish.source == WLC_CIS_SROM) ? "External SPROM" :
(cish.source == WLC_CIS_OTP) ? "Internal OTP" : "Unknown?");
fprintf(stderr, "Printing the data at offset: %d\n", off);
for (i = off; i < (updatelen + off); i++) {
if ((i % 😎 == 0)
printf("\n");
printf("0x%02x ", (uint8)bufp);
}
printf("\n");
done:
return ret;
#endif /* _CFE_ */
}
For testing purpose use the attached file and use the following command:
> wl cisread_offset 10 4
number of digits to be read:4 and offset:10
Source: 2 (Internal OTP)
Printing the data at offset: 10
0x83 0xab 0x80 0x02
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is a provision to pass length parameter in cisdump to dump particular bytes but it is not working.
As a workaround, we can modify cisdump function and print only the contents which are required. Please refer the attached file for wlu_cisread_offset() function which takes the offset and no. of bytes as argument and prints the data. You can copy the same data into a buffer and access it in your application
static int
wlu_cisread_offset(void *wl, cmd_t *cmd, char **argv)
{
#if defined(_CFE_)
return CFE_ERR_UNSUPPORTED;
#elif defined(_HNDRTE_) || defined(__IOPOS__)
return 0;
#else
char *bufp, *endptr;
int ret = 0;
uint32 off;
uint32 updatelen;
uint32 i;
cis_rw_t cish;
UNUSED_PARAMETER(cmd);
/* validate arg count */
if (!*++argv || !argv[1])
return BCME_USAGE_ERROR;
/* grab byte offset */
off = (uint32)strtol(argv[0], &endptr, 0);
if (*endptr != '\0')
return BCME_USAGE_ERROR;
updatelen = (uint32)strtol(argv[1], NULL, 0);
fprintf(stderr, "number of digits to be read:%d and offset:%d\n", updatelen, off);
/* check for a length argument */
if (updatelen & 1) {
printf("Invalid byte count %d, must be even\n", updatelen);
ret = BCME_BADARG;
goto done;
}
/* Prepare the read info */
cish.source = 0; cish.byteoff = 0; cish.nbytes = 0;
/* set up the buffer and do the get */
memset(buf, 0, WLC_IOCTL_MAXLEN);
strcpy(buf, "cisdump");
bufp = buf + strlen("cisdump") + 1;
memcpy(bufp, (char*)&cish, sizeof(cish));
bufp += sizeof(cish);
ret = wl_get(wl, WLC_GET_VAR, buf, (int)((int)(bufp - buf) + (SROM_MAX)));
if (ret < 0) {
fprintf(stderr, "Failed cisdump request: %d\n", ret);
goto done;
}
/* pull off the cis_rw_t */
bufp = buf;
memcpy((char*)&cish, bufp, sizeof(cish));
cish.source = dtoh32(cish.source);
cish.byteoff = dtoh32(cish.byteoff);
cish.nbytes = dtoh32(cish.nbytes);
/* move past to the data */
bufp += sizeof(cish);
printf("Source: %d (%s)\n", cish.source,
(cish.source == WLC_CIS_DEFAULT) ? "Built-in default" :
(cish.source == WLC_CIS_SROM) ? "External SPROM" :
(cish.source == WLC_CIS_OTP) ? "Internal OTP" : "Unknown?");
fprintf(stderr, "Printing the data at offset: %d\n", off);
for (i = off; i < (updatelen + off); i++) {
if ((i % 😎 == 0)
printf("\n");
printf("0x%02x ", (uint8)bufp);
}
printf("\n");
done:
return ret;
#endif /* _CFE_ */
}
For testing purpose use the attached file and use the following command:
> wl cisread_offset 10 4
number of digits to be read:4 and offset:10
Source: 2 (Internal OTP)
Printing the data at offset: 10
0x83 0xab 0x80 0x02