bouffalolab / bouffalo_sdk

BouffaloSDK is the IOT and MCU software development kit provided by the Bouffalo Lab Team, supports all the series of Bouffalo chips. Also it is the combination of bl_mcu_sdk and bl_iot_sdk
Apache License 2.0
372 stars 128 forks source link

USB Flashing doesn't work on Windows 11 #22

Closed gamelaster closed 2 years ago

gamelaster commented 2 years ago

I have BL70X IoT DVK-MB-V1.1, which have BL706 with no internal FLASH or RAM, everything is external. It have Winbond 25Q32JVS1Q and 1604M-3SQR.

Unfortunately, I can't get this flashed with bflb_mcu_tool or Bouffalo Lab Dev Cube, it all ends on Flash load shake hand. I tried to change flash_id = ef8016 (which is flash config for W25Q32JW_ef8016.conf), although, the eflash_loader still can't load the SPI flash. Also I tried to change boot headers with SPI configuration for that same Winbond, still no success. Any ideas?

Thanks

gamelaster commented 2 years ago

Update: I forced BootROM to enable debug printing, and according to it, the Flash ID is 001640EF (so ef4016), but even changing eflash_loader cfg and ini to use ef4016, eflash loader still doesn't work. I also get log from eflash loader, which is as following:

system clock=144M
MCU SDK:ecbaa028e998ecd6187bb3a1eb4127b7c63a0358
BSP Driver:61system clock=144M
Flash ID=AD1640EF
F36M
    QE
      interrupt not support
print 565B84B1
print 565B84B1
print 565B84B1
print 565B84B1
print 565B84B1
print 565B84B1
print 565B84B1
print 565B84B1
print 565B84B1
print 565B84B1
// endless prints "print 565B84B1"

Any ideas? Thanks

gamelaster commented 2 years ago

Update: I get it working. The problem is USB with combination of Windows. For some reason, after eflash_loader is executed, the USB CDC COM port is locked out and flasher can't communicate with it. It works OK on Linux. It's happening only to me, or is this known issue? Is there any fix for it ?

sakumisu commented 2 years ago

This problem has not been encountered. It may be that your flash type is not support in devcube, and the eflash_loader ini and cfg are automatically modified, please do not manually modify.If you use usb to download fail,you can use serial port to have a try.Thanks.

sakumisu commented 2 years ago

If you can, you can send an email to this address : jzlv@bouffalolab.com. Please provide flash download log, it is under devcube directory named log.Thanks.

gamelaster commented 2 years ago

Hi @sakumisu ,

I sent you an email with the log. The UART Flash works OK, and USB Flash works OK on Linux. I talked with Lup Yuen, and he told me that flashing works good on Windows 10. But I have Windows 11, so my suspicion is that Windows 11 have some issues with USB CDC driver. I will test it on Windows 10 and Windows 7 soon. Thanks

gamelaster commented 2 years ago

Hi @sakumisu , I confirmed it, flashing doesn't work on Windows 11, but works on Windows 10. On Windows 7, there is driver missing.

sakumisu commented 2 years ago

Hi, @gamelaster Thank you for your test, Maybe the usb compatibility of win11 is a bit problematic, And in win7, cannot be used directly, you should install driver, this driver should be available online. Maybe we can add it next time.

gamelaster commented 2 years ago

Hi @sakumisu , The Windows 7 driver would be amazing!

About Windows 11 issue, when I started to inspect the issue, I wanted to use https://www.hhdsoftware.com/usb-sniffer for diagnostic the issue. This app install it's own driver to sniff the communication. After installing this driver, it started to work properly. But on my work PC (Windows 11) where I don't have this app, it still doesn't work ☹️ . I don't have hardware USB sniffer, so I can't find the issue. Thanks

gamelaster commented 2 years ago

Together with @Ralim we analyzed this issue (we we're able to reproduce it also on Linux), and able to fix it, so flashing works reliably both on Linux and Windows 10 / 11. Looks like img_load_create_predata_before_run_img which was added in recent version of flasher fixes the issue.

Anyway, I will create separate repository for Windows 7 driver.

Thanks