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

I2c slave implementation #452

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

I2c slave implementation #452

wants to merge 7 commits into from

Conversation

seplog
Copy link

@seplog seplog commented Jun 30, 2021

Hello,

I have implemented a small example for a twi slave on an AVR device.
While I implemented this, I have seen that there a some small bugs within the implementation of the sim_twi.

I think the first was, that the interrupt Flag is cleared while writing a 1 TWIINT register.
The second was some invalid states of the TWI.

I think I have corrected these and attach a very simple implementation of the avr twi slave.

Best regards and many thanks for that great simulator!
seplog

ATMega328p the correct start state for I2C slave is 0x60
Have a look at capt. 21.7.3
The old version sets the state two times. First state 0x60 and then 0x80
Because the TWI_COND_SLAVE is set before the write and after this true
gatk555 pushed a commit to gatk555/simavr that referenced this pull request May 25, 2022
…to fix

include paths in parts/i2c_master.[ch], initialisation of firmware
struct in i2ctest.c (needed after PR buserror#440) and spelling/syntax in README.
@gatk555
Copy link
Collaborator

gatk555 commented May 25, 2022

This needed some small changes when merging: the include paths in parts/i2c_master.[ch] point to an installed version (that I do not have) rather than the build tree and after PR #440 was merged, the firmware struct in i2ctest.c must be initialised. I also tidied some spelling and syntax in the README. My version is here.

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

Successfully merging this pull request may close these issues.

2 participants