Hi, ive been using the Universal serial interface on the attiny24, but im confused on how to select a clock speed (im using the internal 8 MHz oscillator) with three wire mode
could someone explain to me what the different clock sources are more specifically, thanks
Toggling the clock is done by code, so the speed is dependent on how the code is written. I wrote an SPI library a while back (here) and estimated the clock speed to be about 1/10 of the system clock. Unrolling the loop should give a bit of improvement over that. There's also an example in the datasheet.
Im still trying to understand what the Different clock sources are
The clock sources are described in section 14 of the ATtiny24 data sheet - external (PA4), timer compare or internal. Check Jack's code for how to use the internal clock (i.e. repeatedly setting bit o in the control register USICR). If you have read that section of the data sheet and still don't understand, post a more specific question.
ok thanks, also, in the attiny24 datasheet, table 14-2 in the register description talks about clock source and 4 bit counter clock source, could someone elaborate on them?
Thanks again
All the relevant information is in the data sheet, but it may take several readings for it to sink in. What specific point do you not understand? No one wants to write an open-ended essay.
whats the difference between the clock source and the 4 bit clock source? I understand the 4 bit clock source is for the counter, but what about the other one?
Page 118 of the data sheet:
The 4-bit counter can be both read and written via the data bus, and it can generate an overflow
interrupt. Both the USI Data Register and the counter are clocked simultaneously by the same
clock source. This allows the counter to count the number of bits received or transmitted and
generate an interrupt when the transfer is complete. Note that when an external clock source is
selected the counter counts both clock edges. This means the counter registers the number of
clock edges and not the number of data bits. The clock can be selected from three different
sources: The USCK pin, Timer/Counter0 Compare Match or from software.