GPS click on micropython

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Yadnik
Posts: 65
Joined: Thu May 13, 2021 6:01 am

Re: GPS click on micropython

Post by Yadnik » Sat Jul 31, 2021 11:35 am

Yes, it has been stated in the readme:https://github.com/micropython/micropyt ... /README.md
Basic operations like uart.write() work perfectly with the this UART initialisation.
Zephyr's driver model defines the various peripherals by name (and this is configured in the board/mcu definitions and will correspond to pins etc). MicroPython just makes those names available to the machine API.
In general the only issue that you feel is that UART is not responding right?Any other problem you feel that may cause such a problem?
Thank you very much!!

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: GPS click on micropython

Post by pythoncoder » Sun Aug 01, 2021 8:36 am

The way to test a UART is to link the TX and RX lines. The following works on a Pyboard with pins X1 and X2 linked:

Code: Select all

from machine import UART
u = UART(4)
u.init(baudrate=9600)
u.write('Hello\n')
u.readline()
If that works (when adapted for your board) then repeatedly calling u.readline() should return something recognisable when connected to your GPS.
Peter Hinch
Index to my micropython libraries.

Yadnik
Posts: 65
Joined: Thu May 13, 2021 6:01 am

Re: GPS click on micropython

Post by Yadnik » Tue Aug 03, 2021 8:22 pm

I made changes to the program:https://github.com/Yadnik1/GPS-Click/bl ... 20CLICK.py
The output of the program is as follows:

Code: Select all

UART("UART_0", baudrate=115200, data_bits=8, parity_bits=None, stop_bits=1, flow_control=None, timeout=0, timeout_char=0)
Request Timeout: No GPS data is found.
Seeing the output,I feel that there is no such issue with the UART initialisation or the program would not have returned this output.Can there be any other error according to you?
Thank you very much!!

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: GPS click on micropython

Post by pythoncoder » Wed Aug 04, 2021 5:33 am

On the contrary, as far as I can see the program is telling you it is receiving nothing.

Did you test the UART as I suggested? Is that baudrate correct: my GPS uses 9600 unless I send it a special command to change it.
Peter Hinch
Index to my micropython libraries.

Yadnik
Posts: 65
Joined: Thu May 13, 2021 6:01 am

Re: GPS click on micropython

Post by Yadnik » Thu Aug 05, 2021 6:19 pm

Hi Peter,
I tried running the UART program while keeping my GPS connected as you suggested,The output is as follows:
>>> from machine import UART
>>> u = UART("UART_1")
>>> u.init(baudrate=9600)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'UART' object has no attribute 'init'
>>> u.write('Hello\n')
6
>>> u.readline()
b''

I also changed the baud rate to 9600 of my board.Can you please have a look and tell me where I am going wrong.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: GPS click on micropython

Post by pythoncoder » Fri Aug 06, 2021 8:59 am

The fact that

Code: Select all

u.init(baudrate=9600)
fails tells me there is something wrong with the Zephyr port. I'm afraid I can't help there, we really need someone with Zephyr experience.
Peter Hinch
Index to my micropython libraries.

Yadnik
Posts: 65
Joined: Thu May 13, 2021 6:01 am

Re: GPS click on micropython

Post by Yadnik » Fri Aug 06, 2021 9:19 am

The baud rate is configured in the device tree file of the board like this : https://github.com/jadonk/beagle_connec ... reedom.dts, the machine API takes that into use.Hence I think we cannot change uart baud rate using uart.init() method.Also uart.init function is not in the machine_uart.c file:https://github.com/micropython/micropyt ... ine_uart.c

Are the other things right according to you like the uart.write() and uart.readline().
Thank you very much!!

Post Reply