Search found 3821 matches

by dhylands
Wed Mar 02, 2022 5:36 am
Forum: MicroPython pyboard
Topic: UART half duplex for Dynamixel servos
Replies: 7
Views: 4771

Re: UART half duplex for Dynamixel servos

I'd consider an external tri-state gate. The timing of trying to switch the tri-state logic gate using another GPIO pin is near impossile to do, other have tried that from the RPi UART. I did find this circuit for converting full duplex to half duplex on an AVR reference manual. You would also have...
by dhylands
Mon Feb 28, 2022 7:01 pm
Forum: MicroPython pyboard
Topic: UART half duplex for Dynamixel servos
Replies: 7
Views: 4771

Re: UART half duplex for Dynamixel servos

Depending the MCU being used, sometimes you don't need any extra hardware. I have a driver, which you can find over here: https://github.com/dhylands/bioloid3/blob/master/bioloid/stm_uart_port.py which should work on the STM32F4 series and allows you to the the Tx to the Rx and use that as the line ...
by dhylands
Wed Feb 23, 2022 7:55 pm
Forum: General Discussion and Questions
Topic: micropython can't convert int object to str implicitly
Replies: 7
Views: 2657

Re: micropython can't convert int object to str implicitly

Try this instead:

Code: Select all

>>> def str2hex(str):
...       return ":".join("{:02x}".format(c) for c in str)
...
>>> str2hex(b'abcdef')
'61:62:63:64:65:66'
(basically drop the ord) That will work for bytestrings but not regular strings.
by dhylands
Fri Feb 04, 2022 6:19 pm
Forum: Development of MicroPython
Topic: Can't find library for UART while compiling STM32 G0
Replies: 2
Views: 4799

Re: Can't find library for UART while compiling STM32 G0

Your board directory should have an stm32g0xx_hal_conf.h file with a line like this one: https://github.com/micropython/micropython/blob/203ec8ca7fa5f59e20bca95c74a77e3b1e8ef394/ports/stm32/boards/NUCLEO_G474RE/stm32g4xx_hal_conf.h#L8 Then there should be an stm32g0xx_hal_conf_base.h (which you'll n...
by dhylands
Mon Jan 31, 2022 5:40 pm
Forum: General Discussion and Questions
Topic: passing array of data to host computer
Replies: 13
Views: 15602

Re: passing array of data to host computer

To execute a file on the pyboard using rshell, I normally use the repl command and then import the file I want to execute from the repl. You can combine these two into a single line command: repl ~ import hello and that will execute /flash/hello.py on my pyboard. In my own personal workflow I edit t...
by dhylands
Sun Jan 30, 2022 4:12 am
Forum: General Discussion and Questions
Topic: passing array of data to host computer
Replies: 13
Views: 15602

Re: passing array of data to host computer

You can find the most recent pyboard.py in the micropython tools directory:
https://github.com/micropython/micropyt ... pyboard.py
by dhylands
Sat Jan 29, 2022 12:20 am
Forum: General Discussion and Questions
Topic: passing array of data to host computer
Replies: 13
Views: 15602

Re: passing array of data to host computer

There isn't really anything to do on the MicroPython side to toggle between REPL and data mode. When you're executing your code on the MicroPython board then you're no longer in REPL mode. Here's the functions that the MicroPython side uses: https://github.com/dhylands/json-ipc/blob/master/stm_usb_p...
by dhylands
Fri Jan 28, 2022 5:50 pm
Forum: General Discussion and Questions
Topic: passing array of data to host computer
Replies: 13
Views: 15602

Re: passing array of data to host computer

I was thinking of using the same serial-over-USB as the REPL is on. This requires that you disconnect the serial terminal that you use for accessing the REPL, but when your code is running, the REPL isn't. With rshell, I put a repl command right in it so you can easily toggle back and forth between ...
by dhylands
Fri Jan 28, 2022 5:12 pm
Forum: General Discussion and Questions
Topic: passing array of data to host computer
Replies: 13
Views: 15602

Re: passing array of data to host computer

You definitely don't want to be writing it to a file, especially if you're using USB Mass Storage. Having MicroPython write to the filesystem while it's mounted via MSC is basically a receipe for corruption. I'd recommend that you send the data back to the host through the serial link. I'd probably ...