Dropping into Bootloader automatically on some hosts


I had been testing TinyFPGA B2 with Joris’ CDC RTL on only a MacBook Pro with USB Type C connectors, Mac OS X 10.13.2. I decided to try it on an older (USB 2.0?) MacBook Air with OS X 10.12.3.

When plugged into the Pro, the FPGA configuration (eventually) is the user application (my CDC code)

When plugged into the Air, the B2 doesn’t run the user application, it stays configured with the boot loader instead. I’ve not looked into the boot loader RTL to see what that might be…

Any ideas how to mitigate this?


Right now the bootloader is configured to keep running if it detects it is connected to a USB host. It detects this by looking for SOF packets. If it does not detect SOF packets it will timeout and load the user configuration.

There are some cases where the host detects the device connect and tries to configure the TinyFPGA B2 before the FPGA finishes configuring itself. In those cases the host will not be sending SOF packets to the port because the device did not respond to the control transfers to configure it. The USB bootloader will then timeout and load the user configuration. The real solution to this problem is a pull-up resistor controlled by the bootloader. The pull-up won’t be enabled until the USB bootloader is ready.

If you’re using the ‘tinyfpgab’ script you can run ‘tinyfpgab -b’ to exit the bootloader and load the user configuration.


Ah. So that means that the Mac Pro is failing to be detected by the boot loader, because it recognizes the presence of the D+ pullup too quickly, ok. So that says the boot loader is not detecting properly with a fast host and that when it does it is not really possible to use the USB for another function without a work around, as it stands.

Unfortunately, once the host has enumerated the against the boot loader, getting it to reenumerate the user function is a problem until the resistor is driven. I’m not sure if it is safe to drive SE0 onto the bus from the function side to cause a re-enumeration. One would assume that the host side is going to see the bus is being driven, and hold off transmitting…


Its safe to drive the D+ line to 0. There are 68ohm resistors on the D+/D- lines so worst case is about 4ma if host and device drive 0 and 1. It’s also for a very short time. I might even have a case in the USB bootloader where it will drive SE0 to emulate a disconnect.