Skip to content
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 ATtiny816 / 1-series ATtiny #131

Open
chris-b-tanner opened this issue Aug 3, 2023 · 3 comments
Open

Support for ATtiny816 / 1-series ATtiny #131

chris-b-tanner opened this issue Aug 3, 2023 · 3 comments

Comments

@chris-b-tanner
Copy link

chris-b-tanner commented Aug 3, 2023

I am struggling to get the ATtiny816 to respond as a OneWire device to an ESP32 master. Running the DS18B20 example.

Background info:
The bus and master physically work. I have another real DS18B20 on the same OneWire bus and it's seen fine by the host (an ESP32); the reset pulse from the ESP32 looks a strong low on a 'scope. I've tested the ATtiny without this separate device on the bus as well.
I can run the DS18B20 emulation code fine on an ATtiny85, so it's something related to the ATtiny816.
4k7 pullup is on the ESP32 end.
I'm using PlatformIO, but I don't suspect that makes a difference.
Nothing else is hooked up to the ATtiny apart from a 1uF cap from VCC to GND and the debug LED.
The DS18B20 emulation code runs on the ATtiny816, with the LED/blink at exactly 1s, but nothing on OneWire.
I've confirmed the OneWire pin I'm using on the ATtiny (10 / PB4) can be manipulated fine from the code, and it receives the low pulse into the calibration code.
The ATtiny816 runs the calibration code with a serial output, but I had to edit to while (repetitions++ < 5) in order for it to come out of the other end with a value_ipl (which strangely gives me 11 not 13 which is the default for the AVR)
No response on OneWire for IPL at either 11, 12 or 13

I have set fuses to use both 16Mhz and 20Mhz internal clock.

OneWireHub version 3.0.0
PlatformIO config:

platform = atmelmegaavr
platform_packages = platformio/tool-avrdude
board = attiny816
build_flags = -DCLOCK_SOURCE=6
framework = arduino
board_build.f_cpu = 16000000L
upload_protocol = serialupdi
lib_deps = orgua/OneWireHub
@chris-b-tanner
Copy link
Author

I have managed to get the calibration code running (previously my OneWire master was only running a bus search a few times; not enough for the calibration code), and I'm getting 10 instructions per loop. Updating platform.h to this value for the AVR doesn't make the device show on the OneWire bus with the DS18B20 example. My fuses are set to 16MHz internal clock.

Some debug Serial.println() from the calibration script:

time_for_reset > 488
loops_for_reset > 779
microsecondsToClockCycles(1) > 16
instructions per loop > 10

@Stopfbit
Copy link

I have also the same problems to get a response from ATTin816 or ATTin817 to simulate a DS2431.
I have tested to set the frequency to 20MHz (default) or set manually to 16Mhz.

I tried also the tips from the post by imdbere from the thread: Compile errors with new ATTiny chips #89 .
Unfortunately, this was not successful.
Is there already a How-To to make OneWireHub usable on the ATTinyAVR 1-series?

Thanks!

programming platform: PlatformIO
Programming Interface: Microchip Studio UPDI Programmer ( uses the created firmware.elf from platformIO)

PlatformIO.ini:
[env:ATtiny817]
platform = atmelmegaavr
board = ATtiny817
framework = arduino
lib_deps =
orgua/OneWireHub @ ^3.0.0
; change microcontroller
board_build.mcu = attiny817
; change MCU frequency
board_build.f_cpu = 20000000L
lib_ldf_mode = deep+

[env:ATtiny816]
platform = atmelmegaavr
board = ATtiny816
framework = arduino
lib_deps =
orgua/OneWireHub @ ^3.0.0
; change microcontroller
board_build.mcu = attiny816
; change MCU frequency
board_build.f_cpu = 16000000L

@Stopfbit
Copy link

Stopfbit commented Aug 28, 2024

The commit of mgrosvenor solves the problem for me: 81d7b88
Thanks for the solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants