1.0 KiB
I2C Detect
I pretty much always need a i2c bus scanner whenever I start a new project. I figured I'd just formalize the code and stick it here.
The d21 project will compile and run on the samd21 xplained pro. The e54 project will compile and run on the same54 xplained pro. The code is extremely portable though. Just replace your i2c read and write functions with your hardware specific functions.
Right now I have no pullups enabled so you'll need to provide your own. Eventually I'll add the option to turn pullups on easily.
SAME54 XPLAINED PRO
The Virtual Com port via EDBG is used for the com port. You can change this at e54/asf4/config/conf_board.h.
USART
- RX: PB24
- TX: PB25
Baud Rate: 115200
I2C
- SDA: PA22
- SCL: PA23
Clock frequency: 400khz
SAMD21 XPLAINED PRO
The Virtual Com port via EDBG is used for the com port. You can change this at d21/asf3/d21_i2c_detect/src/config/conf_board.h.
USART
- RX: PA23
- TX: PA22
Baud Rate: 115200
I2C
- SCL: PA09
- SDA: PA08
Clock frequency: 400khz