Hey,
I just finished writing a USB bootloader and a GUI to operate it. (based on some code from mabl and demos)
You will need to install the provided drivers manually to use it. Only tested on win7 x64 so far, will do linux later on.
https://github.com/mobyfab/ChibiOS-Bootloader
Let me know if it works for you, any feedback is appreciated!
Thanks!
USB Bootloader
Re: USB Bootloader
Fabien, hi! Just flashed your bootloder.
I can connect to the device from GUI, but every commnad results in
"WinUsb_ReadPipe" ERROR_SEM_TIMEOUT 121
Then I flashed user_app manually. I've got composite USB and CDC, but bootloader GUI still can't do anything with it.
Shell works on CDC, but no commands are recognized. It always answers "<command> ?"
I can connect to the device from GUI, but every commnad results in
"WinUsb_ReadPipe" ERROR_SEM_TIMEOUT 121
Code: Select all
New Transfer Thread
***[ bool __thiscall MainWindow::Connect(void) ]***
***[ bool __thiscall QUsb::GetDeviceHandle(struct _GUID,void **) ]***
Device path: \
***[ bool __thiscall QUsb::GetWinUSBHandle(void *,void **) ]***
***[ bool __thiscall QUsb::GetUSBDeviceSpeed(void *,unsigned char *) ]***
Device speed: 1 (Low speed).
***[ bool __thiscall QUsb::QueryDeviceEndpoints(void *,struct QUsb::PIPE_ID *) ]
***
Bulk OUT Endpoint index: 0 Pipe type: Bulk Pipe ID: 0x03.
Bulk IN Endpoint index: 1 Pipe type: Bulk Pipe ID: 0x83.
***[ int __thiscall QUsb::read(class QByteArray *,unsigned int) ]***
"WinUsb_ReadPipe" ERROR_SEM_TIMEOUT 121
***[ int __thiscall QUsb::write(class QByteArray *,unsigned int) ]***
Sent 5 / 5 bytes: "AF:EB:A5:05:44"
***[ int __thiscall QUsb::read(class QByteArray *,unsigned int) ]***
"WinUsb_ReadPipe" ERROR_SEM_TIMEOUT 121
Then I flashed user_app manually. I've got composite USB and CDC, but bootloader GUI still can't do anything with it.
Shell works on CDC, but no commands are recognized. It always answers "<command> ?"
Re: USB Bootloader
mhhh seems like it's using the wrong endpoints. should be 0x01 and 0x81, not 0x03 and 0x83.
I will have to hardcode them I guess. Are you sure it's running the bootloader and not the user app?
You need to reset the mcu for the bootloader to not launch the user app. (you can do this with stlink)
You can also send the 0xAB byte to the bulk interface (endpoint 3), it will trigger a reset.
I will have to hardcode them I guess. Are you sure it's running the bootloader and not the user app?
You need to reset the mcu for the bootloader to not launch the user app. (you can do this with stlink)
You can also send the 0xAB byte to the bulk interface (endpoint 3), it will trigger a reset.
Re: USB Bootloader
I've erased flash by st-link and flased bootloader again. Then I flashed user app by GUI, this time it's flashed, but with errors.
So no USB CDC, not BULK, and reflashing bootloader did not help. I need to manually erase page at 0x08004000 to make bootloader to work again.
Code: Select all
New Transfer Thread
***[ bool __thiscall MainWindow::Connect(void) ]***
***[ bool __thiscall QUsb::GetDeviceHandle(struct _GUID,void **) ]***
Device path: \
***[ bool __thiscall QUsb::GetWinUSBHandle(void *,void **) ]***
***[ bool __thiscall QUsb::GetUSBDeviceSpeed(void *,unsigned char *) ]***
Device speed: 1 (Low speed).
***[ bool __thiscall QUsb::QueryDeviceEndpoints(void *,struct QUsb::PIPE_ID *) ]
***
Bulk OUT Endpoint index: 0 Pipe type: Bulk Pipe ID: 0x01.
Bulk IN Endpoint index: 1 Pipe type: Bulk Pipe ID: 0x81.
***[ int __thiscall QUsb::read(class QByteArray *,unsigned int) ]***
"WinUsb_ReadPipe" ERROR_SEM_TIMEOUT 121
***[ int __thiscall QUsb::write(class QByteArray *,unsigned int) ]***
Sent 5 / 5 bytes: "AF:EB:A5:05:44"
***[ int __thiscall QUsb::read(class QByteArray *,unsigned int) ]***
Received 2 of 2 Bytes: "50:01"
Writing flash
File size 45396
***[ int __thiscall QUsb::write(class QByteArray *,unsigned int) ]***
Sent 9 / 9 bytes: "AF:EB:A1:09:54:B1:00:00:49"
***[ int __thiscall QUsb::read(class QByteArray *,unsigned int) ]***
Received 2 of 2 Bytes: "50:10"
Erase OK
Writing from "0x0" to "0xb154"
Read 96 Bytes from disk
***[ int __thiscall QUsb::write(class QByteArray *,unsigned int) ]***
Sent 105 / 105 bytes: "AF:EB:A3:69:00:00:00:00:00:04:00:20:81:42:00:08:41:43:00:
08:41:43:00:08:41:43:00:08:41:43:00:08:41:43:00:08:41:43:00:08:41:43:00:08:41:43
:00:08:41:43:00:08:71:43:00:08:41:43:00:08:41:43:00:08:41:43:00:08:41:44:00:08:4
1:43:00:08:41:43:00:08:41:43:00:08:41:43:00:08:41:43:00:08:41:43:00:08:41:43:00:
08:41:43:00:08:CE"
***[ int __thiscall QUsb::read(class QByteArray *,unsigned int) ]***
Received 1 of 1 Bytes: "50"
Read 96 Bytes from disk
***[ int __thiscall QUsb::write(class QByteArray *,unsigned int) ]***
Sent 105 / 105 bytes: "AF:EB:A3:69:60:00:00:00:41:43:00:08:41:43:00:08:41:43:00:
08:41:43:00:08:41:43:00:08:41:43:00:08:41:43:00:08:41:43:00:08:41:43:00:08:41:43
:00:08:41:43:00:08:41:43:00:08:41:43:00:08:41:43:00:08:41:43:00:08:41:43:00:08:4
1:43:00:08:41:43:00:08:41:43:00:08:41:43:00:08:41:43:00:08:41:43:00:08:41:43:00:
08:41:43:00:08:26"
***[ int __thiscall QUsb::read(class QByteArray *,unsigned int) ]***
Received 1 of 1 Bytes: "72"
Transfer done
So no USB CDC, not BULK, and reflashing bootloader did not help. I need to manually erase page at 0x08004000 to make bootloader to work again.
Re: USB Bootloader
Done, I have updated the drivers and the GUI binary.
You have to reinstall the drivers. (uninstall devices and delete driver, reinstall using new driver files)
I have tested it under windows and linux, it should work fine now
You have to reinstall the drivers. (uninstall devices and delete driver, reinstall using new driver files)
I have tested it under windows and linux, it should work fine now
