tinyvision-ai-inc / pico-ice

Raspberry Pi PICO board + Lattice iCE40 FPGA's
MIT License
142 stars 26 forks source link

Board can't run fpga flash after reboot #39

Closed vanbwodonk closed 4 months ago

vanbwodonk commented 6 months ago

Hi, I have bought 2pcs pico-ice from elecrow. However, 1 board cannot run FPGA programs from flash. I flashed using dfu-util, using pico-ice-default version 1.5. FPGA runs normally after flashing, but if the USB power is turned off and then turned on again. FPGAs can't run from flash.

It's not a problem for me to check the flash chip/replace it. Is there a way to ensure that the flash chip (winbond) is truly damaged?

josuah commented 6 months ago

Hello! Thank you for getting in touch. There could be other reasons such as a problem in the firmware that make the FPGA go in halt mode, such as when the UF2 programming interface is read by the OS: the pico-ice storage device... or other quirks.

One way to test would be this small example that writes to the flash and read the result back (use test.py to see how to test for instance): https://github.com/tinyvision-ai-inc/pico-ice-sdk/tree/main/examples/pico_flash

Another way would be trying this other example as it contains the DFU prorammer in addition to the UART interface: https://github.com/tinyvision-ai-inc/pico-ice-sdk/tree/main/examples/pico_usb_uart

I did find an error while programming to flash using DFU-util using that hexample though:

Download        [                         ]   0%            0 bytesdfu-util: Error during download get_status (LIBUSB_ERROR_PIPE)

I will investigate the bug and it will be fixed as part of the upcoming v1.6 default firmware and SDK release... It is also possible to try the UF2 programming method in hope that this gives more luck: https://pico-ice.tinyvision.ai/md_programming_the_fpga.html#autotoc_md34

josuah commented 6 months ago

It might be interesting to try this again after https://github.com/tinyvision-ai-inc/pico-ice-sdk/pull/51 gets merged.

vanbwodonk commented 5 months ago

Thank you. My pico-ice is in the office, i will try it on Monday.

vanbwodonk commented 5 months ago

Tried this PR, and it works. I hope this will be merged soon.

Update about my flash error:

but if the USB power is turned off and then turned on again. FPGAs can't run from flash.

This problem occurred because I flashed the FPGA firmware in CRAM, because I read the old code when the Flash was DFU+1. But still pico-ice-default version 1.5 can't dfu-util flash area with this error:

 Download        [                         ]   0%            0 bytesdfu-util: Error during download get_status (LIBUSB_ERROR_PIPE)
josuah commented 5 months ago

There is definitely some problem with the firmware. In about a month, I will be given some time to come back to all the pico-ice issues.

I will try to get something going by then to fix the pain-points. Hopefully this will be included.

josuah commented 4 months ago

I only completed the review now. This is now merged and a new release is being prepared. Thank you all for this collaborative review and improvements! A new release is pending. Feel free to reopen if anything is missing.