#avr Logs

Jun 17 2019

#avr Calendar

04:08 AM day__ is now known as day
05:41 AM day__ is now known as day
06:03 AM janco_ is now known as janco
08:04 AM janco__ is now known as janco
09:40 AM ravon: What's the channel for the ARM line?
10:50 AM nohit: ravon: #avrs
11:08 AM Kliment: LeoNerd: Thanks for the recommendation
11:09 AM LeoNerd: So yes, ATtiny 1-series TWI
11:09 AM Kliment: I'm trying to get TWI slave running using the atmel start example code
11:09 AM LeoNerd: Oh slave.. hrm. dunno about that one, I've only ever used it in master mode
11:09 AM Kliment: it kinda sorta works - when I try to read from the correct address it will pull the data pin low - and never stop
11:09 AM Kliment: it never even reaches the interrupt
11:10 AM LeoNerd: The *data* pin? If it was clock pin I'd say that sounds like SCL clock stretching
11:10 AM Kliment: sure enough, clock pin is also low
11:10 AM Kliment: just checked
11:11 AM LeoNerd: Righty, that sounds like stretching indeed
11:11 AM Kliment: On the master end, I just have an arduino that goes Wire.beginTransmission(address);Wire.endTransmission();
11:12 AM LeoNerd: Yeah.. I've no idea what Arduino does on those things and whether that even notices clock stretching
11:12 AM LeoNerd: I don't use it myself
11:12 AM Kliment: Where can I disable clock stretching?
11:12 AM Kliment: or rather, why is it there?
11:12 AM LeoNerd: Am looking at the datasheet for tiny814 now.. I see the SSTATUS register has a CLKHOLD bit
11:13 AM LeoNerd: So lets start reading about that
11:13 AM LeoNerd: "Resetting the corresponding interrupt will indirectly reset this flag." - ahah
11:13 AM Kliment: which page?
11:13 AM LeoNerd: So you probably have to reset the receive byte interrupt
11:14 AM LeoNerd: 320 of ATtiny814
11:14 AM LeoNerd: Yeah, one of the things about these new 1-series tinies is that you have to manually clear the interrupt flag inside your ISR or simlar
11:14 AM LeoNerd: As compared the older tiny chips where just invoking the ISR alone was sufficient to clear interrupt status, .. not any more
11:15 AM Kliment: Yeah, trouble is I never get to the ISR
11:15 AM LeoNerd: Hmmm
11:15 AM Kliment: I tried setting a GPIO high in the ISR to test
11:15 AM LeoNerd: Yeah that's usually my plan... "debug by LEDs" :)
11:16 AM LeoNerd: Have you also set TWI0.SCTRLA |= TWI_DIEN_bm; ?
11:16 AM LeoNerd: that appears to be important
11:18 AM Kliment: yes
11:18 AM Kliment: I have
11:18 AM Kliment: I tried disabling it too, no difference
11:18 AM LeoNerd: Hm... I do recall spending longer trying to get TWI working than most other peripherals
11:18 AM LeoNerd: It always seems to need a lot of work
11:22 AM Kliment: do you have a convenient example of working twi?
11:23 AM LeoNerd: Not of a slave, no. I've only ever done master form it
11:23 AM LeoNerd: *from
11:23 AM Kliment: master is fine
11:25 AM LeoNerd: http://paste.debian.net/1088209/ -- twi.[hc] from my avr1hal
11:26 AM Kliment: what pin config do you use for this?
11:28 AM LeoNerd: Er.. good question. Offhand I don't think I have the program around that I used this for. let me see if I can dig it out of history
11:30 AM Kliment: I wonder if my compiler is an issue
11:30 AM LeoNerd: Hmm.. I haven't done any port setup at all
11:30 AM LeoNerd: It seems that on this occasion, the peripheral takes over the pins just fine
11:31 AM LeoNerd: (which is odd because e.g. USART0 still needs you to set pin modes)
11:51 AM Kliment: Yeah, for some reason my interrupt is never triggering
12:02 PM Kliment: Okay, guess which idiot forgot to enable interrupts globally
12:02 PM * Kliment <-- this one
12:03 PM Kliment: everything works fine
12:12 PM Kliment: LeoNerd: Thanks for your help
12:34 PM LeoNerd: Hah.. Ahyes, sei() is a good one
01:09 PM Kliment: Okay, address detection works, now I need to figure out the actual protocol
11:29 PM day__ is now known as day