It's been more than two weeks after my last update on getting the USB host shield working with Espruino. I decided to work on it a bit more yesterday so that it doesn't end up in the abandoned projects drawer.
After I discovered earlier this week that the TUSB3410 chip won't work unless you upload firmware into it first, I decided to change tactics and attempt connecting to a different chip instead. A week ago I got my Node.js user-space driver for the Silicon Labs CP2102 chip working. This chip is inside the OneTouch VerioIQ glucose meter, so I plugged the meter into the USB host shield and started swapping out the TUSB3410 code for CP2102 code.
It again didn't work at first. I connected the logic analyser and noticed that there still wasn't any USB bulk in transfers happening, even though everything sent was being acknowledged by the device. However, there was a glimmer of hope as I discovered some data packets in the bitstream that looked like what I was expecting to receive. So the data was coming back, but my bulk in transfer wasn't created correctly to capture it.
After looking through the code some more, I came to the conclusion that the issue was with the data toggles used by the MAX3421. I finally figured out that I need to keep track of separate toggles for each endpoint, and as soon as that was in place I was greeted with this:
I was able to see data being returned in a bulk in transfer! Amazingly, I'm finally getting data back from a device connected to the USB host shield on my Espruino Pixl.js. I guess this could've happened much sooner if I went with the CP2102 first instead of the TUSB3410.
Now, the next step is to get some actual blood glucose data from the meter and visualise it on the Pixl.js screen. If all goes well, that should be much easier!