-
Notifications
You must be signed in to change notification settings - Fork 221
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
Bit banging I2C #20
Comments
Hi @abbrev, Thanks for raising this idea. |
I think it is not necessary to generate interrupts when using hardware I2C. We can still pull the reg which has the transfer finish flags. In such way, we don't save too much cpu time but rather reduce the size of the code only. |
Yes, this is a good idea, thanks Howard! |
let's assume I2C runs on 800kbps, and the most common usage is SendPLLBRegisterBulk which changes Si5351 clock. The function issues the commands which contains 7 bytes + start + stop = 60 bits. It takes about 60/800k = 0.075ms = 75us. On 16Mhz AVR, it can run 1200 instructions. maybe worth to look at if we can combine freq_calc_fast with SendPLLBRegisterBulk and interleave the code to save some CPU load. |
Hi @threeme3, is there a reason that I2C is bit banged on pins that support hardware I2C? Specifically in
class I2C
:https://github.com/threeme3/QCX-SSB/blob/57e438da4425f3d22deb9ba9b5e64167a20d67b2/QCX-SSB.ino#L768-L775
We can probably at least reduce the code size a little by using the hardware I2C (though it probably wouldn't reduce the CPU load since we'd still have to synchronously wait for each byte to transfer).
The text was updated successfully, but these errors were encountered: