Dual-mode / DUALCTRL on 28pin device, possible? #316
-
Device is a AVR128DA28 ... Platformio IDE I've been trying to get this going for a bit now, no luck. It works fine as Host only or Client only but won't do both on two different sets of pins. The chips never automatically ACK their addresses to the Host, and don't see any clients when I do a scan on the Host pins. The interrupts never trigger either. Here's my setup()
|
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 40 replies
-
https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/DataSheets/AVR128DA28-32-48-64-Data-Sheet-40002183C.pdf page 154 says dual mode defaults to master on A2/A3 slave on C2/C3 so its not the pinout Did you check the simple stuff like pull-ups on the bus to which C2/C3 is connected? is the onReceive/onRequest handler being called (blink an LED or something) |
Beta Was this translation helpful? Give feedback.
-
well s**t ... the stripped down code works in Arduino 1.8.19 I so dislike the Arduino IDE ... but if that's what it takes to get this project to the finish line, I guess I move forward. |
Beta Was this translation helpful? Give feedback.
-
One last ditch effort, hopefully someone, maybe @SpenceKonde or @MX682X can explain what changes these two lines make to the build?
|
Beta Was this translation helpful? Give feedback.
-
I'm pretty sure this will not work. TWI0 and TWI1 are pointers to the hardware modules, but you want to access them as Class structures. You have to use Wire0 and Wire1 instead. Oh, and I would recomend to set the callback functions before |
Beta Was this translation helpful? Give feedback.
-
On a side note: Why do you want to use the Dual mode? I think there might be a misunderstanding, judging by your settings. Dual mode means only that the slave part of the TWI is connected to pins other then master. This only makes sense, in my opinion, on the DB and DD series that have MVIO or when there are two different I2C clocks. |
Beta Was this translation helpful? Give feedback.
-
It would be really great to have an example of dual mode where the chip acted as a slave to another chip, and a master to some random sensor. Cause, Like, I don't know off hand how to do it... |
Beta Was this translation helpful? Give feedback.
-
In any event, I would very very much like to have a known working reliable demo of dual mode in the examples. |
Beta Was this translation helpful? Give feedback.
-
In the file platformio.ini, add -DTWI_MANDS to build_flags, shout out to MX682X for this answer!
|
Beta Was this translation helpful? Give feedback.
In the file platformio.ini, add -DTWI_MANDS to build_flags, shout out to MX682X for this answer!