my device needs to replug after reboot in linux

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
E_521156
Level 4
Level 4
100 sign-ins 50 replies posted 50 sign-ins

Hi,
When my system reboots , it can't find FX3 in linux(I don't have this problem in windows).
I get "No device found", when I run cyusb_linux . (J4 is on). In linux, Fx3 needs to replug after reboot and then I can use it.
I attached the result of  lsusb -t  before repluging

 

Thanks

0 Likes
1 Solution
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Please find my comments below:

1-I put the  SSLB img in 0x0000 and main img file in 0x6000. When I plug it, it boots with sslb img, how can I force it to start with 0x6000? (for combining img files I copied the sencond one in address 0x6000, is it ok?)

>> It seems that for this case you will be enabling the i2c boot macro such that the SSBL boots from I2C EEPROM. Is that correct? If yes, you can use the following 

static uint32_t gI2cByteAddrFW0 = 0x6000; //global variable

static CyBool_t
I2cInit (
        void)
{
    CyFx3BootErrorCode_t   status;
    CyFx3BootI2cConfig_t   i2cConfig;
    CyFx3BootI2cPreamble_t preamble;
    uint8_t               *rd_buf = (uint8_t *)gReadBuf;

    status = CyFx3BootI2cInit ();
    if (status != CY_FX3_BOOT_SUCCESS)
        return CyFalse;


    i2cConfig.busTimeout = I2C_BUS_TIMEOUT_VALUE;
    i2cConfig.dmaTimeout = I2C_DMA_TIMEOUT_VALUE;
    i2cConfig.isDma      = CyFalse;
    i2cConfig.bitRate    = I2C_FREQUENCY;
    status = CyFx3BootI2cSetConfig (&i2cConfig);
    if (status != CY_FX3_BOOT_SUCCESS)
        return CyFalse;

    preamble.buffer[0] = I2C_SLAVE_ADDRESS | I2C_CMD_WRITE;
    preamble.buffer[1] = GET_BYTE1(gI2cByteAddrFW0);
    preamble.buffer[2] = GET_BYTE0(gI2cByteAddrFW0);
    preamble.buffer[3] = I2C_SLAVE_ADDRESS | I2C_CMD_READ;
    preamble.length    = 4;
    preamble.ctrlMask  = I2C_START_BYTE2;

    status = CyFx3BootI2cReceiveBytes (&preamble, rd_buf, FW_HEADER_SIZE, I2C_RETRY_CNT);
    if (status == CY_FX3_BOOT_SUCCESS)
    {
        if ((rd_buf[0] == 'C') && (rd_buf[1] == 'Y') && (rd_buf[3] == 0xB0))
        {
            return CyTrue;
        }
    }

    return CyFalse;
}

 


2- I used CyU3PDeviceReset(CyFalse) with vendor commands to jump to bootloader. for reprogram RAM. I read in a thread that we should use CyU3PUsbJumpBackToBooter. which one is better to use?

>> If you want to jump back to SSBL from application firmware, you can use CyU3PUsbJumpBackToBooter function to transfer control back to the FX3 2-stage bootloader. Please refer to FX3 API guide for more details on this API

 

3- if I used  I2C boot macro, can I update the e2prom img file without changing pmode lines same RAM?

>> Please let me know how are you planning to update the application firmware .img file. Please refer to this blog FX3 Fail Safe Firmware Update - Cypress Developer Community and let me know if this is what you are looking for.

Kindly let me know if any queries on this

Regards,
Rashi

View solution in original post

0 Likes
14 Replies
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted
0 Likes

Hi,
Thanks for your reply. I read this KBA. it seems both workarounds need hardware access. In my case, I need to run the device without any hardware changing, even PMod pins or replug. As I understand, for the second stage bootloader, I need to program img on EEprom/Flash. In this way, is there any way that I update the img file on EEprom without changing the jumper? 
Thank you

0 Likes
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Thanks for your reply. I read this KBA. it seems both workarounds need hardware access. In my case, I need to run the device without any hardware changing, even PMod pins or replug.

>>As the issue is with the primary bootloader which is due to a defect in the device wakeup from low-power suspend mode. The bootloader enters low-power suspend mode during this reboot process  and then has a possibility that the device will not wake when the host comes up again. So, the workarounds mentioned in the KBA will only be helpful.

As I understand, for the second stage bootloader, I need to program img on EEprom/Flash. In this way, is there any way that I update the img file on EEprom without changing the jumper? 

>> The second stage bootloader (.img) can be programmed to EEPROM/FLASH from the USB control center when in USB boot (without changing the PMODE lines to SPI /I2C boot). But the default(i.e. primary) bootloader will not boot from EEPROM/FLASH unless the PMODE lines are configured for same. So, to boot FX3 with second stage bootloader stored in EEPROM/FLASH, PMODE lines need to be changed accordingly.

Regards,
Rashi
0 Likes

Hi,
I did some more tests, I fount that when I reboot from eeprom(j4 is removed), I don't have this problem. but when I put the jumper I have this issue. Of course my issue is that the device doesn't recognize at all and I have to replug it. (but in Q2 of the above mentioned KBA, is talking about when it is unknown device.) 
Now if I could find a way to erase and reprogram EEprom(not second stage bootloader), while the j4 is off, it can solve my problem. is there any way for that?
Thanks

0 Likes
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

From the description, I understand that the issue is not seen when the J4 is removed and EEPROM is programmed with second stage bootloader. Is that correct?

Please give more details on the test so that I can understand the scenario better. 

Regards,
Rashi
0 Likes

Hi,
The issue is not seen when the J4 is removed and EEPROM is programmed. (not with second stage bootloader, I tested with a simple img file, I didn't use SSBL.)

I connect my Fx3 to Linux, when I reboot my linux device, Fx3 is not in usb list( lsusb -t), I have to replug it. 
J4 is on when this issue happens, I don't see this issue when I remove J4 and it boots with EEprom. I should mention that the reboot process of my linux device takes longer than usual when I connect the FX3 with J4 on. I don't have these problems with windows.
Thanks

0 Likes
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

From the description, I understand that you are using FX3 Explorer kit (CYUSB3KIT -003). Please confirm.

If J4 is removed (I2C Boot enabled), the FX3 will boot up with the application firmware from the EEPROM. So, when FX3 is connected to PC, the FX3 will be programmed with the application firmware and will not be in bootloader mode. This means when the Host PC is rebooted, the problem mentioned in KBA will not be seen as FX3 is not in bootloader mode (USB Boot).

As mentioned in the KBA, "The bootloader enters low-power suspend mode during this reboot process  and then has a possibility that the device will not wake when the host comes up again." This might be the reason that the issue is not seen o Linux.

Please let me know if you can directly program the application firmware  to I2C EEPROM and remove the J4 jumper (enable I2C boot). 

If you program the SSBL in EEPROM and change the PMODE settings to I2C boot (J4 removed) as mentioned in the KBA, the device will boot with SSBL and can then have option to boot from either I2C EEPROM,  USB (RAM) or SPI Flash irrespective of the PMODE settings. The SSBL firmware uses macros to define the boot options. According to the application the boot options can be selected by enabling macro. 

Regards,
Rashi
0 Likes

Hi,

--From the description, I understand that you are using FX3 Explorer kit (CYUSB3KIT -003). Please confirm.
yes, I am using CYUSB3KIT -003.

--Please let me know if you can directly program the application firmware to I2C EEPROM and remove the J4 jumper (enable I2C boot).
Generally, I can. But eventually, in my application, I need to change the img file without changing the j4 jumper, so I chose Ram, as I couldn't find any way to reprogram EEprom without changing PMOD lines.

Something is not clear for me, from the last paragraph, do you mean that if I program the SSBL in EEPROM with "USB Boot" macro and change the PMODE settings to I2C boot (J4 removed), then I can reprogram RAM while J4 is removed? or we couldn't update new img file and in fact it is the saved img file in eeprom which will load to RAM?

Thank you

 

0 Likes
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Please find my comments below

Something is not clear for me, from the last paragraph, do you mean that if I program the SSBL in EEPROM with "USB Boot" macro and change the PMODE settings to I2C boot (J4 removed), then I can reprogram RAM while J4 is removed?

>>Yes, your understanding is correct.

Regards,
Rashi
0 Likes

Ok
Thanks.
Please don't close this thread. I get side track by another project. I will test this and let you know about it soon.
Thank you

0 Likes

Hi, 
Thank you Rashi,  I could program ram while jumper is off.
 Only I have a few other question about it:
1-I put the  SSLB img in 0x0000 and main img file in 0x6000. When I plug it, it boots with sslb img, how can I force it to start with 0x6000? (for combining img files I copied the sencond one in address 0x6000, is it ok?)

2- I used CyU3PDeviceReset(CyFalse) with vendor commands to jump to bootloader. for reprogram RAM. I read in a thread that we should use CyU3PUsbJumpBackToBooter. which one is better to use?

3- if I used  I2C boot macro, can I update the e2prom img file without changing pmode lines same RAM?

Thanks alot

0 Likes
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Please find my comments below:

1-I put the  SSLB img in 0x0000 and main img file in 0x6000. When I plug it, it boots with sslb img, how can I force it to start with 0x6000? (for combining img files I copied the sencond one in address 0x6000, is it ok?)

>> It seems that for this case you will be enabling the i2c boot macro such that the SSBL boots from I2C EEPROM. Is that correct? If yes, you can use the following 

static uint32_t gI2cByteAddrFW0 = 0x6000; //global variable

static CyBool_t
I2cInit (
        void)
{
    CyFx3BootErrorCode_t   status;
    CyFx3BootI2cConfig_t   i2cConfig;
    CyFx3BootI2cPreamble_t preamble;
    uint8_t               *rd_buf = (uint8_t *)gReadBuf;

    status = CyFx3BootI2cInit ();
    if (status != CY_FX3_BOOT_SUCCESS)
        return CyFalse;


    i2cConfig.busTimeout = I2C_BUS_TIMEOUT_VALUE;
    i2cConfig.dmaTimeout = I2C_DMA_TIMEOUT_VALUE;
    i2cConfig.isDma      = CyFalse;
    i2cConfig.bitRate    = I2C_FREQUENCY;
    status = CyFx3BootI2cSetConfig (&i2cConfig);
    if (status != CY_FX3_BOOT_SUCCESS)
        return CyFalse;

    preamble.buffer[0] = I2C_SLAVE_ADDRESS | I2C_CMD_WRITE;
    preamble.buffer[1] = GET_BYTE1(gI2cByteAddrFW0);
    preamble.buffer[2] = GET_BYTE0(gI2cByteAddrFW0);
    preamble.buffer[3] = I2C_SLAVE_ADDRESS | I2C_CMD_READ;
    preamble.length    = 4;
    preamble.ctrlMask  = I2C_START_BYTE2;

    status = CyFx3BootI2cReceiveBytes (&preamble, rd_buf, FW_HEADER_SIZE, I2C_RETRY_CNT);
    if (status == CY_FX3_BOOT_SUCCESS)
    {
        if ((rd_buf[0] == 'C') && (rd_buf[1] == 'Y') && (rd_buf[3] == 0xB0))
        {
            return CyTrue;
        }
    }

    return CyFalse;
}

 


2- I used CyU3PDeviceReset(CyFalse) with vendor commands to jump to bootloader. for reprogram RAM. I read in a thread that we should use CyU3PUsbJumpBackToBooter. which one is better to use?

>> If you want to jump back to SSBL from application firmware, you can use CyU3PUsbJumpBackToBooter function to transfer control back to the FX3 2-stage bootloader. Please refer to FX3 API guide for more details on this API

 

3- if I used  I2C boot macro, can I update the e2prom img file without changing pmode lines same RAM?

>> Please let me know how are you planning to update the application firmware .img file. Please refer to this blog FX3 Fail Safe Firmware Update - Cypress Developer Community and let me know if this is what you are looking for.

Kindly let me know if any queries on this

Regards,
Rashi
0 Likes

Hi,
Thank you so much.  This link works for me.
Just one question, Is there linux version of Fx3FirmwareUpdate?
Thanks

0 Likes
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Glad to hear that the link was helpful

We do not have host application similar to FX3FirmwareUpdate for Linux platform. FX3FirmwareUpdate host application can be referred to create custom host application for Linux

Regards,
Rashi
0 Likes