Page 2 of 2

Re: GPS click on micropython

Posted: Sat Jul 31, 2021 11:35 am
by Yadnik
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!!

Re: GPS click on micropython

Posted: Sun Aug 01, 2021 8:36 am
by pythoncoder
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.

Re: GPS click on micropython

Posted: Tue Aug 03, 2021 8:22 pm
by Yadnik
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!!

Re: GPS click on micropython

Posted: Wed Aug 04, 2021 5:33 am
by pythoncoder
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.

Re: GPS click on micropython

Posted: Thu Aug 05, 2021 6:19 pm
by Yadnik
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.

Re: GPS click on micropython

Posted: Fri Aug 06, 2021 8:59 am
by pythoncoder
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.

Re: GPS click on micropython

Posted: Fri Aug 06, 2021 9:19 am
by Yadnik
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!!