Hello
A bit of a strange one?
I have a PIC24FJ64GB002 that I am using as a USB host - using with the Microchip USB host code. The PIC then uses SPI to communicate with another system (the PIC is the slave). That side of it is working.
I then added a simple bootloader. It will update the code okay, but when I jump to the main application from the bootloader, if the device (mouse in this case) is connected the USB side doesn't work for maybe a few minutes, then it kicks into life, as if something has timed out and reset something internally.
If I disconnect and reconnect the mouse, it works straight away. If I don't use the bootloader it works from power up. Both the application and loader are in C. I did try a very thing assembler "pre-loader" that would just check the state of a single digital input and either jump to the application or the loader, but even that didn't work (the test here was to set the input to 1, then tell the PIC to reset itself (with asm "reset") via the SPI link.
I suspect there is some sort of timing thing going on, but I can't see what. As far as I can tell the USB system isn't active during the bootloader (the red LED on the mouse doesn't light up until the application starts).
One solution would be to get the application to somehow reset the USB system as if the device had been reconnected, but I couldn't see how to do that.
Any suggestions would be most welcome.
Thanks
Chris