Serial - bit banging

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
lukesky333
Posts: 44
Joined: Fri Sep 02, 2016 4:07 pm
Location: Austria

Serial - bit banging

Post by lukesky333 » Mon Mar 18, 2019 9:06 am

Hi,

is it possible to read the wakeup bit from the serial port as mentioned here to discover the first byte of a command?

Thanks a lot...

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

Re: Serial - bit banging

Post by pythoncoder » Mon Mar 18, 2019 1:14 pm

According to the docs machine.UART can read 9-bit characters so I don't see why not.
Peter Hinch
Index to my micropython libraries.

lukesky333
Posts: 44
Joined: Fri Sep 02, 2016 4:07 pm
Location: Austria

Re: Serial - bit banging

Post by lukesky333 » Tue May 28, 2019 1:54 pm

pythoncoder wrote:
Mon Mar 18, 2019 1:14 pm
According to the docs machine.UART can read 9-bit characters so I don't see why not.
I'm using the board ttgo mini32 and it seems, that is impossible to read the 9th bit.

Is there another way to read serial in something like a RAW mode?

OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: Serial - bit banging

Post by OutoftheBOTS_ » Tue May 28, 2019 9:29 pm

Don't quote me on this but I think ESP32 hardware serial only has 8 bit serial

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

Re: Serial - bit banging

Post by pythoncoder » Wed May 29, 2019 6:56 am

There is no official soft UART implementation. The best option is probably to use hardware which does support it, such as any Pyboard. A soft UART could be written but would probably be restricted to low baud rates because of ESP32 latency issues.
Peter Hinch
Index to my micropython libraries.

lukesky333
Posts: 44
Joined: Fri Sep 02, 2016 4:07 pm
Location: Austria

Re: Serial - bit banging

Post by lukesky333 » Wed May 29, 2019 7:31 am

OutoftheBOTS_ wrote:
Tue May 28, 2019 9:29 pm
Don't quote me on this but I think ESP32 hardware serial only has 8 bit serial
pythoncoder wrote:
Wed May 29, 2019 6:56 am
There is no official soft UART implementation. The best option is probably to use hardware which does support it, such as any Pyboard. A soft UART could be written but would probably be restricted to low baud rates because of ESP32 latency issues.
What do you mean with "low baud rates"? I need only 19.2K for 2 UARTs, the third is only for upload and development.

Can you suggest any board for my needs?
  • 2 UARTs (9-bit)
  • possibility to connect a SD-card for logging
  • threading support to log 2 UARTs
  • fast and a lot of memory would be nice
  • as cheap as possible ;-)
Thanks a lot for your support...

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

Re: Serial - bit banging

Post by pythoncoder » Wed May 29, 2019 7:49 am

A Pyboard (V1.1 or D series). Whether they meet your requirement for "as cheap as possible" is moot.

I would strongly recommend uasyncio rather than threading for reasons covered in the tutorial in this repo.

Writing a soft UART capable of handling two concurrent 19.2Kbaud streams would be a significant challenge and might not be practicable on ESP32. Unless you fancy the challenge and have plenty of time to devote to it, I'd go for the hardware solution ;)
Peter Hinch
Index to my micropython libraries.

lukesky333
Posts: 44
Joined: Fri Sep 02, 2016 4:07 pm
Location: Austria

Re: Serial - bit banging

Post by lukesky333 » Wed May 29, 2019 8:47 am

pythoncoder wrote:
Wed May 29, 2019 7:49 am
A Pyboard (V1.1 or D series). Whether they meet your requirement for "as cheap as possible" is moot.

I would strongly recommend uasyncio rather than threading for reasons covered in the tutorial in this repo.

Writing a soft UART capable of handling two concurrent 19.2Kbaud streams would be a significant challenge and might not be practicable on ESP32. Unless you fancy the challenge and have plenty of time to devote to it, I'd go for the hardware solution ;)
I've allready seen the Pyboard D-series. It's nice but a lot of money. Is there a cheap alternative board too? I think the possibility to get the "9th bit" depends on the chip, not on the board? What is with this one?

OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: Serial - bit banging

Post by OutoftheBOTS_ » Wed May 29, 2019 11:01 pm

The STM32F407 MCUs have 5 UARTS (3 x USART and 2 X UART).


I prefer the STM32F407VGT6 with 1 mb of flash on the MCU and this board has another 16M-BIT of flash on a separate IC and is under $10US https://www.aliexpress.com/item/STM32F4 ... st=ae803_5

I am not sure if anyone has ported MP to this exact board but I know there is ports for STM32F407VET6 black which is the same but with only 512kb RAM on the MCU

From the reference manual the STM32F407 supports 9 bit serial by setting the M bit in the UART control register
UART 9.JPG
UART 9.JPG (32.74 KiB) Viewed 5342 times

lukesky333
Posts: 44
Joined: Fri Sep 02, 2016 4:07 pm
Location: Austria

Re: Serial - bit banging

Post by lukesky333 » Fri May 31, 2019 11:52 am

OutoftheBOTS_ wrote:
Wed May 29, 2019 11:01 pm
The STM32F407 MCUs have 5 UARTS (3 x USART and 2 X UART).


I prefer the STM32F407VGT6 with 1 mb of flash on the MCU and this board has another 16M-BIT of flash on a separate IC and is under $10US https://www.aliexpress.com/item/STM32F4 ... st=ae803_5

I am not sure if anyone has ported MP to this exact board but I know there is ports for STM32F407VET6 black which is the same but with only 512kb RAM on the MCU
Is it possible to use the same MicroPython version like for the STM32F407VET6 or does it need further development for this board?

Post Reply