Open esternin opened 4 years ago
Revised: If you ever encounter error like this, it is probably because the HID driver (that manages keyboards and mice, etc.) has grabbed your target board and won't let go. Verify that your /etc/udev/rules.d/82-pinguino.rules file is in place (see above) and working as expected. On some systems, $id should be used instead of $kernel,
[INFO] Welcome to Pinguino IDE 13.0.0
[INFO] Compiling: /home/esternin/Pinguino/v13/examples/01.Basics/Blink/Blink.pde
[INFO] Board: PIC32 Pinguino OTG
[INFO] Proc: 32MX440F256H
[INFO] Arch: 32
[INFO] MIPS 16: True
[INFO] Heap size: 512 bytes
[INFO] Optimization: -O2
[INFO] Bootloader: usb
[INFO] compilation done
[INFO] Code size: 1572/233472 bytes (0.67% used)
[INFO] 1.304 seconds process time
[INFO] Looking for a Pinguino device ...
[INFO] Pinguino found ...
[DEBUG] Traceback (most recent call last):
File "/opt/pinguino/v13/pinguino-ide/pinguino/qtgui/ide/methods/decorators.py", line 281, in wrapped
return fn(Pinguino, *args, **kwargs)
File "/opt/pinguino/v13/pinguino-ide/pinguino/qtgui/ide/methods/decorators.py", line 25, in wrapped
return fn(Pinguino, *args, **kwargs)
File "/opt/pinguino/v13/pinguino-ide/pinguino/qtgui/ide/methods/core.py", line 863, in pinguino_upload
uploaded, result = self.pinguinoAPI.upload()
File "/opt/pinguino/v13/pinguino-ide/pinguino/qtgui/pinguino_core/pinguino.py", line 137, in upload
data = self.__upload__()
File "/opt/pinguino/v13/pinguino-ide/pinguino/qtgui/pinguino_core/pinguino_tools.py", line 298, in __upload__
result = self.upload_hex()
File "/opt/pinguino/v13/pinguino-ide/pinguino/qtgui/pinguino_core/uploader/uploader.py", line 233, in upload_hex
self.uploader.uploadDevice(self.hex_file, self.board)
File "/opt/pinguino/v13/pinguino-ide/pinguino/qtgui/pinguino_core/uploader/uploader32.py", line 858, in uploadDevice
handle = self.initDevice(device)
File "/opt/pinguino/v13/pinguino-ide/pinguino/qtgui/pinguino_core/uploader/uploader.py", line 175, in initDevice
handle.setConfiguration(self.ACTIVE_CONFIG)
File "/usr/local/lib/python3.6/site-packages/usb/legacy.py", line 260, in setConfiguration
self.dev.set_configuration(configuration)
File "/usr/local/lib/python3.6/site-packages/usb/core.py", line 869, in set_configuration
self._ctx.managed_set_configuration(self, configuration)
File "/usr/local/lib/python3.6/site-packages/usb/core.py", line 102, in wrapper
return f(self, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/usb/core.py", line 148, in managed_set_configuration
self.backend.set_configuration(self.handle, cfg.bConfigurationValue)
File "/usr/local/lib/python3.6/site-packages/usb/backend/libusb1.py", line 794, in set_configuration
_check(self.lib.libusb_set_configuration(dev_handle.handle, config_value))
File "/usr/local/lib/python3.6/site-packages/usb/backend/libusb1.py", line 595, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 16] Resource busy
To verify that the target board is in place and recognized, one could do the following (idVendor and idProduct must match your board's values, I am using a PIC32-PINGUINO-OTG as an example below)
import usb.core
dev = usb.core.find(idVendor=0x04d8, idProduct=0x003c)
if dev is None:
raise ValueError('PiC32-Pinguino-OTG is not connected')
else:
print(dev)
This python script yields the following output on my system:
DEVICE ID 04d8:003c on Bus 001 Address 042 =================
bLength : 0x12 (18 bytes)
bDescriptorType : 0x1 Device
bcdUSB : 0x200 USB 2.0
bDeviceClass : 0x0 Specified at interface
bDeviceSubClass : 0x0
bDeviceProtocol : 0x0
bMaxPacketSize0 : 0x8 (8 bytes)
idVendor : 0x04d8
idProduct : 0x003c
bcdDevice : 0x2 Device 0.02
iManufacturer : 0x1 Microchip Technology Inc.
iProduct : 0x2 USB HID Bootloader
iSerialNumber : 0x0
bNumConfigurations : 0x1
CONFIGURATION 1: 100 mA ==================================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x2 Configuration
wTotalLength : 0x29 (41 bytes)
bNumInterfaces : 0x1
bConfigurationValue : 0x1
iConfiguration : 0x0
bmAttributes : 0xc0 Self Powered
bMaxPower : 0x32 (100 mA)
INTERFACE 0: Human Interface Device ====================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x4 Interface
bInterfaceNumber : 0x0
bAlternateSetting : 0x0
bNumEndpoints : 0x2
bInterfaceClass : 0x3 Human Interface Device
bInterfaceSubClass : 0x0
bInterfaceProtocol : 0x0
iInterface : 0x0
ENDPOINT 0x81: Interrupt IN ==========================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x81 IN
bmAttributes : 0x3 Interrupt
wMaxPacketSize : 0x40 (64 bytes)
bInterval : 0x1
ENDPOINT 0x1: Interrupt OUT ==========================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x1 OUT
bmAttributes : 0x3 Interrupt
wMaxPacketSize : 0x40 (64 bytes)
bInterval : 0x1
Dear @esternin ,
Thanks for your time to share this info with us.
I plan publish a manual install guide on the Pingüino Website, based on this issue.
Cheers.
Revised: now that all installation issues have been resolved, this is an installation guide.
This is my experience, YMMV. It is the first installation of Pinguino on this Linux workstation (RHEL 7.2 x86_64, though this is probably not so important for this python-based product).
The available installation instructions were followed, but because they were incomplete, or confusing, I will summarize what I did below, hopefully this will help someone as well as explain exactly what my configuration is. None of the "automatic" installation scripts worked in my environment, which is a multi-user installation on a number of workstations, that have a network-mounted shared /opt. In addition to all the PinguinoIDE stuff, I had to retrieve and install the compilers, and also add a reserved.pickle to the user space (this last thing after that space gets created by the first run of the ide python script, so after the inevitable crash at first startup of Pinguino.
In summary, this is what I did. As myself:
Also, download the MPLAB compilers, from
https://www.microchip.com/mplab/compilers
. They are packaged as self-installing scripts,xc32-v2.30-full-install-linux-installer.run
andxc8-v2.10-full-install-linux-installer.run
, so Ichmod 755
them ad execute them. They install into/opt/microchip/xc32
and/opt/microchip/xc8
.I get the p8/p32 compilers from
https://codeload.github.com/PinguinoIDE/pinguino-compilers/zip/master
. I unpack everything in /tmp, then, as root, move everything into one common place I want them to be in, for example:I edit the two config files to reflect this arrangement:
Still as root, I execute (once) the commands in
/opt/pinguino/v13/pinguino-ide/pinguino.sh
, except the last line that launches the IDE, to take care of all missing python bits:Still as root, I add a rules file for the udev/USB recognition.
Optional, but handy: create the desktop launcher file, and place a pinguino icon into the appropriate place. Under Debian (and under Chromebook Linux) you may need to generate a number of .png icons, for every resolution present in the system, as it does not speak .svg yet). Still as root:
Finally, as user, launch through the just-created .desktop launcher, or from a terminal:
First time, it is slow to respond, just wait: itcreates the
~/Pinguino/v13
subdirectory, and copies all example files into it, but crashes because of a missing file, so I exit it, thenand the next time everything works.
I actually have patched my python code to do that automatically, but since this project has not been maintained lately, it is not likely to be incorporated into the distribution, so you will probably have to do the same by hand. If anybody wants, I would be happy to share the patch.
Before attempting to upload a compiled program into the target board, be sure to put the board into the bootloader mode (by holding But and pressing and releasing Rst).