Skip to content

Conversation

PeterKietzmann
Copy link
Member

Contribution description

This PR adds a peripheral I2C driver for nrf52 MCUs.

Issues/PRs references

Continuation of #7557

@PeterKietzmann
Copy link
Member Author

@dylad @lebrush would you have a look at this PR?

@PeterKietzmann PeterKietzmann added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jan 3, 2018
@PeterKietzmann PeterKietzmann force-pushed the dnahm_nrf52_i2c branch 2 times, most recently from 91b4ec8 to 3b36409 Compare January 3, 2018 16:13
@dylad dylad self-assigned this Jan 3, 2018
Copy link
Member

@dylad dylad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR looks good (except some minors things), I'll test it tomorrow.

uint8_t *in_buf = (uint8_t *)data;
assert((bus <= I2C_NUMOF) && (length > 0));

DEBUG("[i2c] reading %i byte from the bus\n", length);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

byte(s) ?
Same for other DEBUG function

*/
static mutex_t locks[] = {
MUTEX_INIT,
MUTEX_INIT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we initialize all bus locks even if only one is enabled through the periph_conf.h file ?

@PeterKietzmann PeterKietzmann removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jan 4, 2018
@PeterKietzmann
Copy link
Member Author

@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)

(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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change TWIM_FREQUENCY_FREQUENCY_K100 to speed so we can run I2C at 400 kHz.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I completely overlooked this one. Fixed in latest commit

@PeterKietzmann
Copy link
Member Author

Ok to squash?

Copy link
Member

@dylad dylad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I successfully tested this PR with a nrf52dk board and one ADXL345 (I2C) using tests/driver_adxl345 -> ACK
You may squash if you want.
Maybe we should wait a bit before merging it to see if another reviewer have time to look at it ?

@PeterKietzmann PeterKietzmann added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jan 4, 2018
@PeterKietzmann
Copy link
Member Author

Squashed. Sure we can wait if you want. But basically this PR is the same as #7557 which was open for about four months.

@dylad
Copy link
Member

dylad commented Jan 8, 2018

Let's merge this one :)

@dylad dylad merged commit 87e3f10 into RIOT-OS:master Jan 8, 2018
@aabadie aabadie added this to the Release 2018.01 milestone Jan 18, 2018
@PeterKietzmann PeterKietzmann deleted the dnahm_nrf52_i2c branch March 4, 2019 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants