Using UART 1

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
Post Reply
yaap
Posts: 2
Joined: Fri Feb 19, 2016 2:24 pm

Using UART 1

Post by yaap » Mon Feb 22, 2016 3:14 pm

Hello guys,

Newbie here o/.

I use a Wipy connected on the development board and I would like to use the second UART interface (UART1).
I'm connected to the wipy through the UART0 via the microUSB cable and I tried this code:

Code: Select all

from machine import UART
u = UART(1, baudrate=115200)
u.readall()
I'm not able to read or write anything. I think it's because I don't really understand the wipy PinOUT.
I connected the GND, GP16, and GP17 to a shikra device.
Should I use the GP23 and GP24 instead? And why?

Could you please explain me what I don't understand here?

Thank you very much!

yaap

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: Using UART 1

Post by danicampora » Mon Feb 22, 2016 6:21 pm

Hello yaap,

Pins GP16 and GP17 will work, you just need to specify them in the constructor:

Code: Select all

u = UART(1, baudrate=115200, pins=('GP16', 'GP17'))
Cheers,
Daniel

yaap
Posts: 2
Joined: Fri Feb 19, 2016 2:24 pm

Re: Using UART 1

Post by yaap » Tue Feb 23, 2016 9:46 am

Thank you very much Dani, it works like a charm :)

But I don't really understand: which pins should be used if I try the example from the doc:

Code: Select all

uart = UART(0, baudrate=9600)

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: Using UART 1

Post by danicampora » Tue Feb 23, 2016 2:28 pm

Hi,

If you check the pinout: https://raw.githubusercontent.com/wipy/ ... PinOUT.png

There are many possible pins that support UART functionality. Default pins for UART0 are GP1 and GP2, if you are using the expansion board it just works because because those are the pins connected to the USB-to-Serial chip. Default pins for UART1 are GP3 and GP4.
I know that documenting the default pins is something that is missing, I'll work on that.

Cheers,
Daniel

JefferyHib
Posts: 1
Joined: Sun Mar 06, 2016 5:05 pm
Location: Canada
Contact:

Using UART 1

Post by JefferyHib » Mon Mar 07, 2016 5:29 am

Does anyone know of any sample code using the bluetooth LE to send data to and from another device using the UART? Adafruit has an example of this, and I wonder if their libraries or examples would work on this device.

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

Re: Using UART 1

Post by dhylands » Mon Mar 07, 2016 6:19 am

The bluetooth devices look like a UART, so basically you just open the uart and send your data. Something like the examples on the UART documentation page:
http://docs.micropython.org/en/latest/l ... .UART.html

I wrote up some information in another post: http://forum.micropython.org/viewtopic. ... 453&p=8646
which describes what I had to do on the host to get bluetooth comms working under Ubuntu.

Post Reply