Wire.h ... setup for Master and Slave on DA28 (TWI_MANDS_SINGLE), etc? #312
Replies: 2 comments 1 reply
-
Wire1 is TWI1. You cannot change the pins on it however, please refer to section 3.6 of the PORTMUX chapter.
If nowhere in the program are the pins changed, there is no reason ro change it from it's defauLt value anyway. Umm to you have warnings enabled? If so either I've been less successful at making them impossible to suppress than I thought, or you should run with warnings enabled. (also per docs, swap() is preferable to pins(). You rely on SDA0 and SCL0. This core doesn't have those, it has SCL and SDA for those pins. What's the standard behavior here? I thought they only added the number after the first one - but if otherboards have SCL0 and SDA0 then it's a bug that I don't define them. |
Beta Was this translation helpful? Give feedback.
-
The compiler seems happy with this, for both the 28pin and 32pin with their respective flags set in platformio.ini. Will find out if it works next week. Does this look proper?
|
Beta Was this translation helpful? Give feedback.
-
Sorry, platformio user here, so I miss out on some of the gui selection goodness of the official IDE.
I am developing on an AVR128DA32 and AVR128DA28 chips, using them as i2c slaves in battery monitoring boards. I have a very nice 24bit 2 channel ADC, that is also i2c, and only has a single fixed address. My goal is having multiple DA chips talking i2c to a master, probably ESP32, which is recording everything to sd card. The DA chips are also doing other monitoring, providing basic BMS type functions and coulomb counting for state of charge.
So, I would like to figure out Master and Slave mode on the DA28, using different pins. Here's what I have so far:
First off, I'm not sure that Wire1 means TWI1, or what? When I try to set pins on Wire1, it complains that pin change is not permitted on 32pin chips.
If I try to use Wire.pins to change pins it also complains. So maybe my assumption of what Wire and Wire1 reference are incorrect.
The code as posted (with the .pins) functions commented out compiles, as long as I add build flag TWI_MORS_BOTH for the 32pin and TWI_MANDS_SINGLE for the 28 pin.
I don't have either chip yet, hopefully this weekend. Any suggestions are welcome.
Full code and project here
Beta Was this translation helpful? Give feedback.
All reactions