unix port machine.UART

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
corleo
Posts: 2
Joined: Sun Nov 13, 2016 4:55 am

unix port machine.UART

Post by corleo » Wed Feb 22, 2017 7:48 am

Hello, everyone!
Does upython unix port really have a 'machine' module with all this classes listed in its doc at http://docs.micropython.org/en/latest/u ... ml#classes ? Because when I try to 'import machine' at unix repl I get "ImportError: no module named 'machine'" and the 'umachine' module has only mem8, mem16, mem32, PinBase and time_pulse_us...

I'm using today's version "MicroPython v1.8.7-320-gda6dbc80 on 2017-02-22". So there is something I can do to use UART in unix port?

Thank you,
Corleo

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: unix port machine.UART

Post by pfalcon » Mon Apr 10, 2017 5:24 am

corleo wrote:Hello, everyone!
Does upython unix port really have a 'machine' module with all this classes listed in its doc at http://docs.micropython.org/en/latest/u ... ml#classes ?
Please read the introduction to the libraries in the documentation: http://docs.micropython.org/en/latest/u ... index.html
Because when I try to 'import machine' at unix repl I get "ImportError: no module named 'machine'"
Per the documentation above, the next step would be checking micropython-lib...
and the 'umachine' module has only mem8, mem16, mem32, PinBase and time_pulse_us...

I'm using today's version "MicroPython v1.8.7-320-gda6dbc80 on 2017-02-22". So there is something I can do to use UART in unix port?
Unix port provides standard "tty" module and that's the most straightforward way to do that. There's also pyserial work-alike: https://github.com/pfalcon/micropython-serial
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

pmp-p
Posts: 13
Joined: Mon Apr 24, 2017 12:45 am

Re: unix port machine.UART

Post by pmp-p » Mon Jul 10, 2017 3:32 pm

Hi, would be nice if someone still remember how to do deal with LPT port as gpio and bind that to umachine on unix port, as you can still find DB25 breakout boards around.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: unix port machine.UART

Post by dhylands » Tue Jul 11, 2017 8:29 pm

There are C libraries which do that: http://parapin.sourceforge.net/ and there is a CPython library called pyparallel:
https://pypi.python.org/pypi/pyparallel/ that you could look at to see if it might be ported to MicroPython.

Post Reply