-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Raspberry RP2040 #123
Comments
Just found the Unfortunately I still don't understand what the other values mean that were configured in #define PIN_TO_BASEREG(pin) (portInputRegister(digitalPinToPort(pin)))
#define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))
#define DIRECT_READ(base, mask) (((*(base)) & (mask)) ? 1 : 0)
#define DIRECT_MODE_INPUT(base, mask) ((*((base)+1)) &= ~(mask))
#define DIRECT_MODE_OUTPUT(base, mask) ((*((base)+1)) |= (mask))
#define DIRECT_WRITE_LOW(base, mask) ((*((base)+2)) &= ~(mask))
#define DIRECT_WRITE_HIGH(base, mask) ((*((base)+2)) |= (mask))
using io_reg_t = uint8_t; // define special datatype for register-access Above is the sample for |
That's mostly Atmel-related lowlevel-stuff to access pins that was needed to allow the fast overdrive-mode of Onewire. Maybe it's time to remove all that error-prone platform-glue and use arduino-commands by default. |
@orgua, it sounds great that you plan to look at supporting the RP2040 in OneWireHub. Ideally an RP2040 implementation should make use of the RP2040 PIO (an IO coprocessor), which allows implementation of serial protocols with single cycle (@125MHz) precision timing, leaving the application/device implementation free of bit-banging code, timing critical sections and avoiding having to disable interrupts. If taking on the PIO is too much for the initial port to RP2040, if you define an API with a sufficiently high abstraction level (addressing and sending bytes), it would be reasonably easy for someone to add a PIO implementation later (via a pull request). Here are a few inspirational resources I have collected that all implement a 1-wire protocol master using the RP2040 PIO for the time-critical serial encoding/decoding:
|
Could you test this ??
|
Hello,
has someone already tried to run OneWireHub on a Raspberry RP2040 like device? Funnily these µC are cheaper than most 1-wire devices, and I would like to use some RP2040 to fake a bunch of DS2450.
After renaming
MEM_SIZE
toMEMORY_SIZE
(or something else, asMEM_SIZE
seems to be a macro in the RP2040 arduino wrapper) I got the code compiling, but I could not get it working, so that the emulated 1-wire devices could be read from another µC.I already found the
platform.h
file but I am not sure, how to adapt this to RP2040 and also I have no clue, if this is really the issue. Any ideas how to go on?best regards,
ahorn
The text was updated successfully, but these errors were encountered: