Hi guys
Thanks for your help!!! apparently everything is working and I've done my first "hallow world"
STM32F4DISCOVERY Setting GPIOs and Modules
Re: STM32F4DISCOVERY Setting GPIOs and Modules
Guys one more questions, Which is the correct way of exiting the REPL window. Every thim I exit by closing the window and try to reenter by typing sudo screen /dev/ttyAMC0 I get a : /dev/ttyACM0 no such file or directory error message
Thanks again
Thanks again
Re: STM32F4DISCOVERY Setting GPIOs and Modules
I guess it depends on the software that you're using. You want it to close the serial port.
If it leaves the serial port open, and the pyboard resets, or is plugged in and unplugged, and /dev/ttyACM0 is still open by some program, then the pyboard will now come up on /dev/ttyACM1
I wrote a program called usb-ser-mon.py which detects when the pyboard goes away, and it will automatically close the serial port and wait for it to show up again.
If you want to give it a try, you can find it here:
https://github.com/dhylands/usb-ser-mon ... ser-mon.py
I've only used it under python2, and it needs pyudev and pyserial to be installed.
If it leaves the serial port open, and the pyboard resets, or is plugged in and unplugged, and /dev/ttyACM0 is still open by some program, then the pyboard will now come up on /dev/ttyACM1
I wrote a program called usb-ser-mon.py which detects when the pyboard goes away, and it will automatically close the serial port and wait for it to show up again.
If you want to give it a try, you can find it here:
https://github.com/dhylands/usb-ser-mon ... ser-mon.py
I've only used it under python2, and it needs pyudev and pyserial to be installed.
Re: STM32F4DISCOVERY Setting GPIOs and Modules
The way to run it is from the termina, when ever I want to close the serial port?
I ran it using python2 usb-ser-mon.py and got the following
julio@julio-virtual-machine:~/workspace_micropython$ python2 usb-ser-mon.py
USB Serial device with vendor 'Micro_Python' serial '000000000011' connected @/dev/ttyACM0
Use Control-X to exit.
Unable to open port '/dev/ttyACM0'
Waiting for USB Serial Device ...
Then I disconected the USB and connected it again and got the following:
USB Serial device with vendor 'Micro_Python' serial '000000000011' connected @/dev/ttyACM0
Use Control-X to exit.
Unable to open port '/dev/ttyACM0'
I ran it using python2 usb-ser-mon.py and got the following
julio@julio-virtual-machine:~/workspace_micropython$ python2 usb-ser-mon.py
USB Serial device with vendor 'Micro_Python' serial '000000000011' connected @/dev/ttyACM0
Use Control-X to exit.
Unable to open port '/dev/ttyACM0'
Waiting for USB Serial Device ...
Then I disconected the USB and connected it again and got the following:
USB Serial device with vendor 'Micro_Python' serial '000000000011' connected @/dev/ttyACM0
Use Control-X to exit.
Unable to open port '/dev/ttyACM0'
Re: STM32F4DISCOVERY Setting GPIOs and Modules
That sounds like there might be permissions problems then. The /dev/ttyACM0 is normally owned by root with a group of dialout.
You can add yourself to the dialout group: and then logout and log back in (if you're running a desktop, then you need log out of the desktop and log back in).
I think adding yourself to dialout group is probably enough, but I also normally add udev rules like is documented on this page:
https://github.com/micropython/micropyt ... -Discovery
The udev rules allows you to use dfu-util without needing to use sudo.
You could also try running usb-ser-mon.py using sudo, but I don't like doing that. The log file it creates will then also be owned by root, and you'll need to use sudo to remove it.
You can add yourself to the dialout group:
Code: Select all
sudo adduser your-username dialout
I think adding yourself to dialout group is probably enough, but I also normally add udev rules like is documented on this page:
https://github.com/micropython/micropyt ... -Discovery
The udev rules allows you to use dfu-util without needing to use sudo.
You could also try running usb-ser-mon.py using sudo, but I don't like doing that. The log file it creates will then also be owned by root, and you'll need to use sudo to remove it.
Re: STM32F4DISCOVERY Setting GPIOs and Modules
Hi Dave
I tried your program and it works great. thanks
I have an issues though with the ttyAMC0 port when I run screen or picocom still. I was wondering if you may have some other suggestions on how to fix it. I get the following error message :
FATAL: cannot open /dev/attyAMC0: No such file or directory
But the funny thing is that if that I type:
julio@julio-virtual-machine:~/workspace_micropython$ ls -l /dev/ttyACM0
I get:
crw-rw-rw- 1 root dialout 166, 0 Aug 2 12:44 /dev/ttyACM0
running dmesg I get:
[ 5758.200063] usb 2-2.2: Product: Pyboard Virtual Comm Port in FS Mode
[ 5758.200068] usb 2-2.2: Manufacturer: Micro Python
[ 5758.200071] usb 2-2.2: SerialNumber: 000000000011
[ 5758.205243] usb-storage 2-2.2:1.0: USB Mass Storage device detected
[ 5758.206775] scsi35 : usb-storage 2-2.2:1.0
[ 5758.207251] cdc_acm 2-2.2:1.1: This device cannot do calls on its own. It is not a modem.
[ 5758.207285] cdc_acm 2-2.2:1.1: ttyACM0: USB ACM device
[ 5759.212398] scsi 35:0:0:0: Direct-Access uPy microSD Flash 1.00 PQ: 0 ANSI: 2
[ 5759.213668] sd 35:0:0:0: Attached scsi generic sg2 type 0
[ 5759.218419] sd 35:0:0:0: [sdb] 480 512-byte logical blocks: (245 kB/240 KiB)
[ 5759.221450] sd 35:0:0:0: [sdb] Write Protect is off
[ 5759.221467] sd 35:0:0:0: [sdb] Mode Sense: 00 00 00 00
[ 5759.224132] sd 35:0:0:0: [sdb] Asking for cache data failed
[ 5759.224145] sd 35:0:0:0: [sdb] Assuming drive cache: write through
[ 5759.309220] sdb: sdb1
[ 5759.331427] sd 35:0:0:0: [sdb] Attached SCSI removable disk
I have add my self into the dialout group , so my guess is that it does not have to do with permissions.
Any ideas of what may be happening?
Is there a way to reset the ttyACM0 / 1 ports?
Thanks
I tried your program and it works great. thanks
I have an issues though with the ttyAMC0 port when I run screen or picocom still. I was wondering if you may have some other suggestions on how to fix it. I get the following error message :
FATAL: cannot open /dev/attyAMC0: No such file or directory
But the funny thing is that if that I type:
julio@julio-virtual-machine:~/workspace_micropython$ ls -l /dev/ttyACM0
I get:
crw-rw-rw- 1 root dialout 166, 0 Aug 2 12:44 /dev/ttyACM0
running dmesg I get:
[ 5758.200063] usb 2-2.2: Product: Pyboard Virtual Comm Port in FS Mode
[ 5758.200068] usb 2-2.2: Manufacturer: Micro Python
[ 5758.200071] usb 2-2.2: SerialNumber: 000000000011
[ 5758.205243] usb-storage 2-2.2:1.0: USB Mass Storage device detected
[ 5758.206775] scsi35 : usb-storage 2-2.2:1.0
[ 5758.207251] cdc_acm 2-2.2:1.1: This device cannot do calls on its own. It is not a modem.
[ 5758.207285] cdc_acm 2-2.2:1.1: ttyACM0: USB ACM device
[ 5759.212398] scsi 35:0:0:0: Direct-Access uPy microSD Flash 1.00 PQ: 0 ANSI: 2
[ 5759.213668] sd 35:0:0:0: Attached scsi generic sg2 type 0
[ 5759.218419] sd 35:0:0:0: [sdb] 480 512-byte logical blocks: (245 kB/240 KiB)
[ 5759.221450] sd 35:0:0:0: [sdb] Write Protect is off
[ 5759.221467] sd 35:0:0:0: [sdb] Mode Sense: 00 00 00 00
[ 5759.224132] sd 35:0:0:0: [sdb] Asking for cache data failed
[ 5759.224145] sd 35:0:0:0: [sdb] Assuming drive cache: write through
[ 5759.309220] sdb: sdb1
[ 5759.331427] sd 35:0:0:0: [sdb] Attached SCSI removable disk
I have add my self into the dialout group , so my guess is that it does not have to do with permissions.
Any ideas of what may be happening?
Is there a way to reset the ttyACM0 / 1 ports?
Thanks
Re: STM32F4DISCOVERY Setting GPIOs and Modules
Hmm. That seems odd. The correct name of the port is /dev/ttyACM0 not /dev/attyACM0sajulios wrote:Hi Dave
I tried your program and it works great. thanks
I have an issues though with the ttyAMC0 port when I run screen or picocom still. I was wondering if you may have some other suggestions on how to fix it. I get the following error message :
FATAL: cannot open /dev/attyAMC0: No such file or directory
What does:
Code: Select all
usb-ser-mon.py -l
ok - that looks good.But the funny thing is that if that I type:
julio@julio-virtual-machine:~/workspace_micropython$ ls -l /dev/ttyACM0
I get:
crw-rw-rw- 1 root dialout 166, 0 Aug 2 12:44 /dev/ttyACM0
So the real question is where is the 'a' in front of tty coming from?
If you run
Code: Select all
usb-ser-mon.py -v -l
Re: STM32F4DISCOVERY Setting GPIOs and Modules
I got :
julio@julio-virtual-machine:~/workspace_micropython$ python2 usb-ser-mon.py -v -lpyudev version = 0.16.1
echo = 0
USB Serial Device with vendor 'Micro_Python' serial '000000000011' found @/dev/ttyACM0
julio@julio-virtual-machine:~/workspace_micropython$ python2 usb-ser-mon.py -v -lpyudev version = 0.16.1
echo = 0
USB Serial Device with vendor 'Micro_Python' serial '000000000011' found @/dev/ttyACM0