FWIW, here's how I ended up solving the problem:
if reset_pin == low then
-- disconnect USB. This allows you to start the bootloading
software
-- later on the host without it recognizing the device as a
modem
UCON_USBEN = low
-- print a message (on an attached 16x2 LCD) to press the reset
-- a second time. Before pressing the switch, start the bootloading
-- software on the host computer
lcd_clear_line(0)
lcd_clear_line(1)
lcd_cursor_position(0,0) -- to 1st line, 1st char
print_string(lcd, str_confirm_reset_1) -- print line 1
lcd_cursor_position(1,0) -- to 1st line, 1st char
print_string(lcd, str_confirm_reset_2) -- print line 1
-- wait a second for switch debounce
delay_100ms(10)
-- wait until switch is pressed
while reset_pin == high loop
end loop
-- reset registers and goto 0x000
asm reset
end if
Special thanks to Ivan for recommending using "asm reset" over "asm
goto 0x000"
-Jim
On Feb 11, 11:31 am, Jim Gregory <[email protected]> wrote:
> I'm currently programming an 18f2550 using the usbbootloader.py
> running on Debian Linux and using the bootloader autostart code taken
> from 18F4550_usb_bootloader_autostart.jal in the "samples" directory.
> I have the BOOT_DELAY_IN_SECONDS set to 8.
>
> It will work reliably if I unplug my development board from the
> computer, start usbbootloader.py (as root) on my PC, then plug the USB
> line from my development board back into the PC while usbbootloader.py
> is running.
>
> What I would *like* to do, however, is invoke bootloading from a
> switch on the development board while the program on the chip is
> running normally. My reset code is simply:
>
> if reset_pin == low then
> asm goto 0x000
> end if
>
> This will cause the chip to reset and my computer to disconnect the
> device & wait the required 8 seconds. However, usbbootloader.py fails
> to reprogram the chip, returning:
>
> Traceback (most recent call last):
> File "/home/jimg/uc/pic/jallib24/usb_bootloader/UsbBootLoader.py",
> line 543, in <module>
> print"Boot device version number " +
> str( test_loader.WaitForDevice() )
> File "/home/jimg/uc/pic/jallib24/usb_bootloader/UsbBootLoader.py",
> line 118, in WaitForDevice
> usb_driver = UsbBootLoaderDriver()
> File "/home/jimg/uc/pic/jallib24/usb_bootloader/
> UsbBootLoaderDriver.py", line 93, in __init__
> self.device = self.device_descriptor.get_device()
> File "/home/jimg/uc/pic/jallib24/usb_bootloader/
> UsbBootLoaderDriver.py", line 38, in get_device
> buses = usb.busses()
> File "/usr/local/lib/python2.6/dist-packages/usb/legacy.py", line
> 333, in busses
> return (Bus(),)
> File "/usr/local/lib/python2.6/dist-packages/usb/legacy.py", line
> 329, in __init__
> self.devices = [Device(d) for d in core.find(find_all=True)]
> File "/usr/local/lib/python2.6/dist-packages/usb/legacy.py", line
> 314, in __init__
> self.configurations = [Configuration(c) for c in dev]
> File "/usr/local/lib/python2.6/dist-packages/usb/core.py", line 723,
> in __iter__
> yield Configuration(self, i)
> File "/usr/local/lib/python2.6/dist-packages/usb/core.py", line 419,
> in __init__
> configuration
> File "/usr/local/lib/python2.6/dist-packages/usb/backend/
> libusb10.py", line 471, in get_configuration_descriptor
> config, byref(cfg)))
> File "/usr/local/lib/python2.6/dist-packages/usb/backend/
> libusb10.py", line 403, in _check
> raise USBError(_str_error[ret], ret, _libusb_errno[ret])
> usb.core.USBError: [Errno 5] Input/output error
>
> I've tried various time delays without success. Does anyone have any
> suggestions on how I might be able to make this work?
>
> -Jim
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en.