cpu/nrf52: add i2c driver and configs#8318
Conversation
91b4ec8 to
3b36409
Compare
dylad
left a comment
There was a problem hiding this comment.
This PR looks good (except some minors things), I'll test it tomorrow.
cpu/nrf52/periph/i2c.c
Outdated
| uint8_t *in_buf = (uint8_t *)data; | ||
| assert((bus <= I2C_NUMOF) && (length > 0)); | ||
|
|
||
| DEBUG("[i2c] reading %i byte from the bus\n", length); |
There was a problem hiding this comment.
byte(s) ?
Same for other DEBUG function
cpu/nrf52/periph/i2c.c
Outdated
| */ | ||
| static mutex_t locks[] = { | ||
| MUTEX_INIT, | ||
| MUTEX_INIT |
There was a problem hiding this comment.
Should we initialize all bus locks even if only one is enabled through the periph_conf.h file ?
|
@dylad thanks for your review. Please have a look at the latest commits. I've tested this implementation with a srf02 ultrasonic (I2C) sensor and the nrf52dk and the aconno board (acd52832) |
cpu/nrf52/periph/i2c.c
Outdated
| (TWIM_SHORTS_LASTRX_STOP_Enabled << TWIM_SHORTS_LASTRX_STOP_Pos); | ||
|
|
||
| /* bus clock speed configuration */ | ||
| dev(bus)->FREQUENCY = (TWIM_FREQUENCY_FREQUENCY_K100 << TWIM_FREQUENCY_FREQUENCY_Pos); |
There was a problem hiding this comment.
Please change TWIM_FREQUENCY_FREQUENCY_K100 to speed so we can run I2C at 400 kHz.
There was a problem hiding this comment.
Good catch! I completely overlooked this one. Fixed in latest commit
|
Ok to squash? |
fcf2f39 to
6245b41
Compare
|
Squashed. Sure we can wait if you want. But basically this PR is the same as #7557 which was open for about four months. |
|
Let's merge this one :) |
Contribution description
This PR adds a peripheral I2C driver for nrf52 MCUs.
Issues/PRs references
Continuation of #7557