Success: OneWire on PortC (PIN_PC1) pins for a Attiny3226 #1239
Replies: 1 comment 4 replies
-
|
Hello! Glad to read that someone has the progress, anyway, I am trying to get the LIN going, have the hw setup ready, namely using the TJA1021 trans., and just starting with the USART setup, for example, it was much easy to use the RS485, because, the megaTinyCore serial setup directly supports, I guess it is the same with the "one-wire", for example several options are avilable:
SERIAL_TX_ONLY - Enables only Tx.
SERIAL_MODE_SYNC - Uses synchronous mode instead of asynchronous. See notes below, additional configuration required. SERIAL_RS485 - Enables RS485 mode. Not sure what would be the right option 1), 2) or 3) or something else? Anyway, the RS485 transceiver needed the so called dir., which I did manually via pulling the pin to high or low when dealing with Serial.flush(), anyway, I guess when using serial. flish() and LIN I do the same, to actually enable the transciever? If any of you have ever dealt with the TJA1021 or similar trans. ideas , solutions are more than welcom! Best. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I was trying to make the patched version of OneWire work on a Attiny3226 but found that the scope was reporting no activity on the port as reset was called. The port and wiring tested out ok with digitalWrite, but OneWire reset failed to read or write anything and return 0, causing search to exit reporting no devices.
So I created patched version first using Fast Digital IO which worked and then using VPORT after reading the Fast Digital IO code.
Here is the snippet of defines which is working for me. ONE_WIRE_PIN has to be defined at compile time.
I didnt find out why the original patched OneWire code this manipulates the registers fails on ths chip, but this worked for me with an unmodified DallasTemperature lib. Code here https://github.com/ieb/N2KEngine/blob/main/lib/vportonewire/VPortOneWire.cpp#L161, also removed the unnecessary mask etc usage in each method, but I suspect the compiler would have removed this anyway.
HTH someone with the same edge case.
I had used the patched OneWire code before on PORTA and PORTB pins without problems. Didn't fancy OneWireNG.
Beta Was this translation helpful? Give feedback.
All reactions