Commit Graph

6 Commits

Author SHA1 Message Date
KurtE 1fad381513 [RP2040] Allow any GPIO pin for RS485 direction pin
As I mentioned in issue #6310 while investigating that the Teensy port
did not support RS485_dir pin on normal GPIO pins, I found that it
was not implemented either as well on some other ports.

So was curious to implement it for RP2040 using same approach as I did
for the MIMXRT in the Pull Request #6328

That is I setup the specified pin as a normal GPIO pin in output mode
and then when you do a write operation it sets the GPIO pin logically
high, and when the write completes I set it logically low.

Note: knowing when I can set it low can be tricky, as you need to make
sure the full output has completed otherwise the data will be corrupted.

I am using:         uart_tx_wait_blocking(self->uart);
Which looks like it is supposed to wait until the busy status is no
longer set, which the Reference manual mentioned, but this is leaving
the line logically set longer than I would like.

however I have tried running it with my hacked up version of the
Python Robotis DynamixelSDK and was able to talk to some AX servos.

I did have to change the library slightly for the RP2040, as the
library was erroring out when you did something like uart.read(5)
and it timed out without receiving anything.  The RP2040 returned
None whereas I think the Teensy returned an empty set, which is what
it looks like the PySerial original code expects.

Not sure if anyone is interested in this, but thought i would
put it out as PR and see.
2022-04-30 14:31:08 -07:00
microDev a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
Scott Shawcroft 52bc935fa7
A few minor fixes for corner cases
* Always clear the peripheral interrupt so we don't hang when full
* Store the ringbuf in the object so it gets collected when we're alive
* Make UART objects have a finaliser so they are deinit when their
  memory is freed
* Copy bytes into the ringbuf from the FIFO after we read to ensure
  the interrupt is enabled ASAP
* Copy bytes into the ringbuf from the FIFO before measuring our
  rx available because the interrupt is based on a threshold (not
  > 0). For example, a single byte won't trigger an interrupt.
2021-02-25 16:50:57 -08:00
microDev 5d7fdafcde
implement suggested changes
- add internal buffering
- rtc initialization fix
2021-02-25 00:48:36 +05:30
microDev b12ccefbe6
uart implementation for rp2040 2021-02-19 18:36:00 +05:30
Scott Shawcroft 733094aead
Add initial RP2040 support
The RP2040 is new microcontroller from Raspberry Pi that features
two Cortex M0s and eight PIO state machines that are good for
crunching lots of data. It has 264k RAM and a built in UF2
bootloader too.

Datasheet: https://pico.raspberrypi.org/files/rp2040_datasheet.pdf
2021-01-20 19:16:56 -08:00