Commit Graph

10 Commits

Author SHA1 Message Date
559a403836 Do not reply with NAK on last byte
At least the bcm2835 (Raspberry Pi 3) I2C/SMBus master has problems
when replying with a NAK to the last byte written to a slave device.

Fix this by replying with NAK one byte later.
2021-02-20 22:12:01 +01:00
baf5a895b5 Update README 2020-10-26 19:53:43 +01:00
964c933bf3 Do not rely on Clockstretching for writes 2020-02-02 00:03:09 +01:00
5bdbb430e7 Fix NACK handling for flash write 2020-02-01 23:59:15 +01:00
0416a2f536 Cleanup and reduce size 2020-02-01 23:58:50 +01:00
1ff13ca69e
Fix markdown table on github 2019-11-06 13:24:46 +01:00
fc61d39288 Do not use IRQs and remove vector table
Do not use ISRs and poll for interrupt flags in the main loop.
No need for moving vector table into bootloader and back.

Remove vector table by adding LDFLAGS = -nostartfiles.
Manually add some code which is now removed, but still needed by C
runtime:
- make sure that r1 is 0x00 (zero register).
- on some MCUs the stack pointer is not initialized correctly after
reset.
- main() need to be placed in special section .init9 to be called at all.

Not sure why the BSS and DATA segment are still initialized.

This change is heavily based on the optiboot bootloader.
2019-11-06 13:18:53 +01:00
b60a0fe735 Simplify ACK handling
TWEA bit in TWCR register needs to be cleared to send NACK.
Clear it when too many bytes were received, re-enable it after
when going idle.

Add missing state for prev. send NACK.
Catch all invalid states and reset bus.

TWINT bit needs to be set every time in ISR.
2019-11-06 13:18:53 +01:00
eee017dedf Split TWI handling into read/write functions 2019-11-06 13:18:53 +01:00
f4ef7a7b1e Update code style
Update indention to spaces
Fix comments
Add README.md and GPL-2 LICENSE files
2019-11-06 13:18:53 +01:00