-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
machine.u2if.py line 40 self.serial_number = instead serial_number = #4
Comments
Hello, Normally the serial number is assigned to the object in line 20. Could you show the start of your script because normally there is no need to instantiate the class u2if.Device yourself (indirectly by a Machine class such as Pin). If there is a need to select a pico with a particular S/N you can call machine.select_interface ("0xYYYYYYYYYYYYY") at the very beginning of the script. |
Hi execuc, |
A question: the pcb 'PICO-DEV-V2' you created or is it a board that is commercially available? |
I understand better what you want to do and you may not have to use this project. There is always the possibility of programming the pico directly in C ++ but it is also possible to code in Python with MicroPython (https://www.raspberrypi.org/documentation/rp2040/getting-started/#getting-started-with- micropython) or Adafruit CircuitPython (https://circuitpython.org/board/raspberry_pi_pico/). If you want to control electronics from your PC, for example, to have buttons that launch actions on your PC and status leds, then you can use this U2IF project. It is then necessary to install the firmware u2if.uf2 in the PICO.
In the u2if case, if you want to light a led, all you have to do is:
However, it is not possible to act on led of Pin 25 in the u2if case because it is permanently modified by the firmware (status led). About PICO-DEV-V2, it is a board that I created with KiCAD, there are gerber files if you want to make one. |
Hi execuc, I worked the whole day intensively to find solutions to several problems I was confronted with. |
Hi, I will take a look as soon as i can. |
Hi execuc,
|
I just ran a successful test within MS Windows 10 from within Windows Terminal. Yesterday late evening. I made a short video of a testrun at that moment. See Attachment #1 for a snapshot of that video showing the search for a compatible board results. 2021-06-16_12h39_psk_blink.py_testrun.mp4 |
Conclusion about experiment results yesterday: I think that various error like 'module hid not found' and 'OSError' were caused by the fact that I used that 'ActivePython' from ActiveState Inc. that did not do its job as expected but I did not realize myself that I was using a 'special' version of Python3. |
OK, I uninstalled ActivePython 3.8.2 from ActiveState Inc. Then there were two Python versions, both Microsoft's, active. (See attachment #1). Running psk_blink.py with 'python3' again resulted in module 'hid' not found. Running the script with 'python' ran OK. A 'pip3 install hid' reported various 'Ignoring invalid distribution'. After reading an article on StackOverflow I checked and discovered that I had three folders in C:\Python39\Lib\site-packages subfolders which names started with a tilde (~). I removed them. After this I checked 'pip3 install hid' again and no more install error. Instead: 'Requirement already satisfied: hid in c:\python39\lib\site-packages (1.0.4)'. Conclusion: on my desktop PC running MS Windows 10 I have to run u2if scripts using 'python' (3.9.0 from Oct 5 2020, installed in c:\python39). |
Hi execuc, |
To be sure that I have the right firmware flashed I: from within Ubuntu I re-flashed the Pico with the 'u2if_pico_i2s_v0.5.0.uf2' from /u2if/firmware/release (built on 2021-06-15) just a moment ago. Ran i2s_play_sound.py again, but no audio. Only the led (status) blinking in the rythm of the datastream transfer. I am almost sure that the 'no audio' is caused by Pin definition. |
2021-06-17_RPi_Pico_U2IF_I2S_play_sound_test.mp4In u2if/firmware/source/source I found the files: board_config.h and board_config.h.in. Each of them defines for the Pico's I2S, |
Latest. The U2IF I2S play a song does not work in MS Windows 10. Looks like a rights problem. Also it doesn't work in MS Windows / WSL1/Ubuntu. In that environment it does not show a comport like /dev/ttyACM0 like in a 'real' Ubuntu O.S. session. I edited a Starwars intro .wav file. The I2S player didn't accept because it detected it was mono. So I converted the file into stereo (L and R the same audio). That worked. |
For me we can close the issue. |
First of all, thank you for persevering. It really pleased me to see your video with the PICO playing the sound! Indeed I looked the Pico Audio Pack and it does not use the same pins as what I fixed in #define. For information the file "board_config.h" is generated from "board_config.h.in" by the cmake. For mono sound, it is normal that it does not work because for the moment, the firmware only manages 16bits stereo. I have to make it evolve, knowing that now there is a user! Mono would reduce the bandwidth of the usb. Do you have several PICOs connected at the same time ? Because otherwise there is normally no need to specify the serial number. Anyway, it should work on Windows 10 and WSL base so I'll investigate when I can. |
Hi execuc! Thank you for your reply. I am happy that you liked the short video. I did not have other Pico's attached at that moment. I own four of them. I have also a Arduino Nano RP2040. An hour ago I was studying the c:\python39\Lib\site-packages\serialwin32.py and .win32.py. I hoped to get a grasp why your U2IF repo I2S play a song example does not go in Windows or Windows/WSL1. OK, fine that you want to investigate more when you can. I am already some time in pension. So, I have a lot of free time :-) If I can be of some assistance don't hesitate to ask. |
Popped back into my mind the following question: why has your repo a complete copy of the pico-sdk ? Because you modified some of that repo's file(s)? I see that it is a little over 1,4GB of disk space it takes. I already have pico-sdk installed on the pc and have set the PICO_SDK_PATH. If you did not modify anything then I think I can delete that (double) installation. Don't you think? |
Hello, |
Add firmware build and release workflow
when using machine.u2if.py I was confronted with an error
I investigated the cause. I found that
line 40 reads: serial_number = self._hid.serial
and line 49 reads: return self.serial_number.
When I changed line 40 into: self.serial_number = self._hid.serial
the error disappeared and I got an answer: the serial number of the Pico.
The text was updated successfully, but these errors were encountered: