2023-01-27 06:28 AM
Hello,
While having a look at NVM flashing example, I came across those lines:
I2C_Read_USB_PD(0,DEVICE_ID,&Buffer,1);
// DEV_CUT 0 : 1600 , 1 Reserved , 2 : 1602 , 3 Autorun
if(Buffer & ID_Reg >= CUT)
{
if ( nvm_flash(0) == 1)
printf("STUSB Flashing Failed \r\n"); // Port 0 mean I2C1 For I2C2 change to Port 1
else printf("STUSB Flashing Done\r\n");
}
else printf("STUSB Flashing Not done : Bad version\r\n");
With my STUSB4500QTR the returned deviceID is 0x25. (On the chip 4500 / M24605 is written).
With this code, everything works (flash and read) but I need explanations for this line :
if(Buffer & ID_Reg >= CUT)
As ID_Reg and CUT are constants, I supposed that this line should more be something
like this:
if ((Buffer & ID_Reg) >= CUT)
But with this code, flash does not occur anymore.
The comment on line 2 in first snippet does not help a lot.
Please can you provide some information on the meanings vs capabilities of productId
and the mean of this line of code?
Thanks
Julien
NVM flash what does "if ((Buffer & ID_Reg) >= CUT)" mean?
on my road on using STUSB4500