ipm on stm32f4

170 views
Skip to first unread message

kittipon meesompop

unread,
Dec 3, 2013, 10:37:02 AM12/3/13
to python-o...@googlegroups.com
Hello everyone,

i tried to compile pymite and flash it onto stm32f4 and want to lunch examples via ipm.
i bought FOCA FT232 an USART-USB-Converter and connect TX to PA2 and RX to PA3.

now i lost connection over stlink, this is clear for me. but i can not flash anything with arm-none-eabi-gdb onto the board.
i tried with ipm by lunching this command
                 ~/pymite/src/tools$ sudo python ipm.py -f ../platform/stm32f4/pmfeatures.py  --serial=/dev/bus/usb/003/011 --baud=57600

and i got following errors
Traceback (most recent call last):
  File "ipm.py", line 427, in <module>
    main()
  File "ipm.py", line 390, in main
    conn, pmfeatures_filename = parse_cmdline()
  File "ipm.py", line 385, in parse_cmdline
    c = SerialConnection(options.serdev, options.baud)
  File "ipm.py", line 158, in __init__
    self.s = serial.Serial(serdev, baud)
  File "/usr/local/lib/python2.6/site-packages/serial/serialutil.py", line 282, in __init__
    self.open()
  File "/usr/local/lib/python2.6/site-packages/serial/serialposix.py", line 296, in open
    self._reconfigurePort()
  File "/usr/local/lib/python2.6/site-packages/serial/serialposix.py", line 325, in _reconfigurePort
    raise SerialException("Could not configure port: %s" % msg)
serial.serialutil.SerialException: Could not configure port: (25, 'Inappropriate ioctl for device')


therefore i would like to post this case, if someone has the case too.
and hopefully someone can help me.

best regards

bard stéphane

unread,
Dec 3, 2013, 5:44:29 PM12/3/13
to python-o...@googlegroups.com
please, step by step :-D
This a good bunch of technologies and system blend
path, cross compilation, usb communication and so on.
If you how to debug you can do what ever you want. because
ipm.py is just another python programm (a little bit more complicate
but that's all)

first check your device with putty and a simple main.py
check you've got the right to access your device

putty -serial -sercfg 57600 /dev/ttyUSB0
google it about device rights and configuration etc ...
check you're using 3.3V for FOCA and check your connection
cable (sorry for this stupid question, but ... sometime we miss
:D )

then just use your FOCA to get log with
putty -serial -sercfg 57600 /dev/ttyUSB0
don't use ipm for the moment.

modify your main.py to add some print
see code modification at the bottom.
The function "default_demo"
wait that you click on blue button and loop
over a simple demo (glowing led, playing with axel
and so on ...)

and print things on FOCA. normally
tx should be green when something is emitted by STM32F4
on FOCA. check the green light :). I've put
a print in the while loop so you will have immediate print

if it's correct you 've got 2 links with 2 usb cables
one on foca and one on debug part of stm32f4.
use scons -c and scons -c PLATFORM=stm32f4
to clean.

===================================

def default_demo():
"""
"""
while True:
print "hello"
wait_BTN_release()
x.AXEL(0)
LED_all();
while 0==x.BTN(): # until push USER BUTTON
print "button 1"
LED_glow_seq(i)
wait_a_bit()
wait_BTN_release()
x.AXEL(1)
print "button 2"
while 0==x.BTN(): # until push USER BUTTON
axel= x.AXEL()
LED_axel_indicate(axel)
wait_a_bit()

def main():
"""
"""
#launch_ipm()
default_demo()
#gpio_demo()




Le 03/12/2013 16:37, kittipon meesompop a �crit :
> --
> --
> You are subscribed to the "python-on-a-chip" (or p14p for short)
> Google Group.
> Site: http://groups.google.com/group/python-on-a-chip
>
> ---
> You received this message because you are subscribed to the Google
> Groups "python-on-a-chip" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to python-on-a-ch...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

kittipon meesompop

unread,
Dec 5, 2013, 11:16:10 AM12/5/13
to python-o...@googlegroups.com
thank a lot for the help. now i can run the default_demo program. But i tried with gpio_demo it does not work.

and i am confusing with the usart in the datasheet i saw PA3->USART2_RX and PA2->USART2_TX. but u said pa3->tx and pa2->rx. i tried both ways but i got unreadable information on putty-console.
Le 03/12/2013 16:37, kittipon meesompop a �crit :

stéphane bard

unread,
Dec 5, 2013, 11:42:22 AM12/5/13
to python-o...@googlegroups.com
PA3 -> TX means : pin PA3 of STM32F4 ------ to  ---------> TX pin of FOCA
PA2 -> RX means : pin PA2 of STM32F4 ------ to  ---------> RX pin of FOCA

if STM32F4 emit bits on PA2 you should received them on RX pin of FOCA :-D you can't put a TX pin with a TX pin
that's all

but if you tried both did you correctly check your device /dev/ ... ?



2013/12/5 kittipon meesompop <kittipon....@gmail.com>

kittipon meesompop

unread,
Dec 5, 2013, 12:12:50 PM12/5/13
to python-o...@googlegroups.com
Oh ur right!! i forgot this point!!
i checked /dev/.. this seemed ok:
[21842.640593] usb 2-1.2: FTDI USB Serial Device converter now attached to ttyUSB0
[22618.899213] ttyUSB0: 1 input overrun(s)
[22797.675747] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[22816.618886] usb 2-1.2: FTDI USB Serial Device converter now attached to ttyUSB0
but if i run gui of putty i got message "unable to open..."

bard stéphane

unread,
Dec 5, 2013, 4:20:11 PM12/5/13
to python-o...@googlegroups.com
this mean you must change the acl, I write something about this in the documentation
(rtfm ?)

   - Vérifier que votre utilisateur a accès au port série (/dev/ttyUSB0 dans notre exemple)::
           (myvenv)dev@tuck-eeepc:~/pymite/src/tools$ ls -al /dev/ttyUSB0
           (myvenv)dev@tuck-eeepc:~/pymite/src/tools$ groups
           (myvenv)dev@tuck-eeepc:~/pymite/src/tools$ dev dialout
           # sinon vous deverez ajouter votre utilisateur à 'dialout'
           (myvenv)dev@tuck-eeepc:~/pymite/src/tools$ sudo usermod -a -G dialout dev
=>
   - Check that user can access serial device (/dev/ttyUSB0 in you example)
           (myvenv)dev@tuck-eeepc:~/pymite/src/tools$ ls -al /dev/ttyUSB0
           (myvenv)dev@tuck-eeepc:~/pymite/src/tools$ groups
           (myvenv)dev@tuck-eeepc:~/pymite/src/tools$ dev dialout
           # other why you should add your user to 'dialout' group
           (myvenv)dev@tuck-eeepc:~/pymite/src/tools$ sudo usermod -a -G dialout dev

kittipon meesompop

unread,
Dec 6, 2013, 1:29:56 AM12/6/13
to python-o...@googlegroups.com
thanks alot. i got it. but putty shows me unreadable informations. i guest it shouĺd show me the infos like print "Hello", right?
now i am finding out how to config it correctly :)

stéphane bard

unread,
Dec 6, 2013, 5:06:35 AM12/6/13
to python-o...@googlegroups.com
if it's unreadable, I think you didn't specify the speed (57600 in my project)
or you change the speed of the USART ?


2013/12/6 kittipon meesompop <kittipon....@gmail.com>
thanks alot. i got it. but putty shows me unreadable informations. i guest it shouĺd show me the infos like print "Hello", right?
now i am finding out how to config it correctly :)

--

kittipon meesompop

unread,
Dec 15, 2013, 10:16:46 AM12/15/13
to python-o...@googlegroups.com
i corrected the baudrate in SConscript to 57600

the command: python2.6 ipm.py -f ../platform/stm32f4/pmfeatures.py  --serial=/dev/ttyUSB0 --baud=57600
seems to work. i can turn on and off LED. but after i wrote syntax e.g. ipm>x.led(0,100)    and pressed enter
The program seems to be in an endless loop and i have to do keyboard interrupt(ctrl+C) before i can write next commands.
Is it going right?

bard stéphane

unread,
Dec 15, 2013, 3:14:35 PM12/15/13
to python-o...@googlegroups.com
hum, there's a bug I never correctly fixed.
The c++ program which listen on STM32F4 the USART for
pymite don't read correctly the end of sentence and
goes to infinite loop and wait the EndOfCommunication
event.
I could send you the file and line where the bug is. But I don't know
how to fix it correctly. Normally it works, you may slowdown the
baud rate. It should fix this problem.
--

kittipon meesompop

unread,
Dec 18, 2013, 12:10:19 AM12/18/13
to python-o...@googlegroups.com
thanks for infos.

i am going to write _NATIVE_ programs. I found some discussions about the topic. But i dont find any documents which describe about
the syntaxes or how to write it. Now i am trying to understand your examples with PWM and try write ADC and DAC similarly.

best regards
Reply all
Reply to author
Forward
0 new messages