Search found 16 matches

by Duality
Fri Jan 08, 2021 6:16 am
Forum: General Discussion and Questions
Topic: uart.read() is giving accumulated data
Replies: 18
Views: 8366

Re: uart.read() is giving accumulated data

Hi Peter, Thank you for your suggestions, I put a timeout in uart definition like: u2 = UART(2, 9600, tx=23,rx=22, timeout=20) This has resolved the issue :) . Below 20 ms (critical timeout), it is behaving like previously (accumulated data of 120 bytes). Also if I increase the baud rate to 19200, t...
by Duality
Thu Jan 07, 2021 5:09 am
Forum: General Discussion and Questions
Topic: uart.read() is giving accumulated data
Replies: 18
Views: 8366

Re: uart.read() is giving accumulated data

Hi All, This is the updated problem statement. I am doing a loopback in this case (in earlier scenario, I was using a different device which was sending the UART data). from machine import UART import utime, uselect u1 = UART(1, 9600, tx=17,rx=16, parity=None, stop=1, ) u2 = UART(2, 9600, tx=23,rx=2...
by Duality
Wed Jan 06, 2021 12:33 pm
Forum: General Discussion and Questions
Topic: uart.read() is giving accumulated data
Replies: 18
Views: 8366

uart.read() is giving accumulated data

Hello All, I am using micropython on esp32. I have got a query regarding uart.read() function. Here is a basic code for a uart read: from machine import UART, Pin import utime, uselect u2 = UART(2, 9600, stop=1, tx=23,rx=22, txbuf=512, rxbuf=512, timeout_char=2) count=0 while True: poll = uselect.po...
by Duality
Mon Nov 23, 2020 9:44 am
Forum: ESP32 boards
Topic: Integrating gsm module from lobo port to main micropython esp32 port
Replies: 2
Views: 1955

Integrating gsm module from lobo port to main micropython esp32 port

Hi All, I want to integrate gsm module provided in lobo esp32 port here in the micropython esp32 port. It will be very useful for all, in my opinion, who are using gsm hardware in there projects. So, I have : 1. copied the modgsm.c, modgsm.h file in the ports/esp32 folder 2. created a libs folder, i...
by Duality
Thu Oct 29, 2020 11:09 am
Forum: ESP32 boards
Topic: UART.irq in micropython
Replies: 1
Views: 1131

Re: UART.irq in micropython

One method could be configuring uart wakeup (for lightsleep), however I don't see any function in micropython to enable this.

Regards.
by Duality
Thu Oct 29, 2020 10:57 am
Forum: ESP32 boards
Topic: UART.irq in micropython
Replies: 1
Views: 1131

UART.irq in micropython

Hi All, In my journey towards running Modbus on esp32, there is one more hurdle and this is power consumption. The esp has to remain turned on in active mode to look for the master query. As my device is an IoT device, it cannot afford to provide mAs of current continuously. So, I am looking for a s...
by Duality
Thu Oct 29, 2020 10:38 am
Forum: ESP32 boards
Topic: Uart wait_tx_done function in ESP32 Micropython
Replies: 9
Views: 4544

Re: Uart wait_tx_done function in ESP32 Micropython

Thank you all for your inputs. Since I am working with the workaround for now, let's see if this works out well. I gave sleep time in between uart_wait_tx_done and for now it is working fine.

Regards
by Duality
Mon Oct 19, 2020 11:01 am
Forum: ESP32 boards
Topic: Uart wait_tx_done function in ESP32 Micropython
Replies: 9
Views: 4544

Re: Uart wait_tx_done function in ESP32 Micropython

Hi Dave, Thank you for your reply. micropython uart.write() function returns when the data is written to Tx ring buffer (whenever space is available). uart.wait_tx_done checks the Tx_FIFO (hardware FIFO). I have given enough sleep in between write and wait_tx_done functions. May be, I am missing the...
by Duality
Thu Oct 08, 2020 12:35 pm
Forum: ESP32 boards
Topic: Uart wait_tx_done function in ESP32 Micropython
Replies: 9
Views: 4544

Re: Uart wait_tx_done function in ESP32 Micropython

I tried increasing the rx and tx buffer size from 256 to 512 in machine_uart.c. I was able to write multiple registers upto 25. But sometimes it was failing. I now, have the workaround. But if wait_tx_done() function works than the communication failures can be avoided.
by Duality
Thu Oct 08, 2020 11:27 am
Forum: ESP32 boards
Topic: Uart wait_tx_done function in ESP32 Micropython
Replies: 9
Views: 4544

Re: Uart wait_tx_done function in ESP32 Micropython

Hi Robert, Thank you for your reply. Considering maximum number of registers to be written simultaneously are 50 (Modbus pdu length for writing this data 109 bytes), at 9600 baud, comes out to be 102 ms. I put 150 ms in the pdMS_TO_TICKS() as shown below and tried again. But I could not write even 2...