arduino / arduino/ArduinoCore-samd

board_driver_i2c.c: hardcoded mask for PM register using SERCOM0

Open
#478 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
502
Forks
740
PR merge metrics
No merged PRs in 30d

Description

Hi!

I spent a lot of time trying to get the I2C to work on SERCOM3.

Registers didn't seem to update when configuring it, and I had changed the default defines to SERCOM3 instead of SERCOM0:

```
#define I2C_SERCOM SERCOM3
#define I2C_SERCOM_GCLK_ID GCLK_CLKCTRL_ID_SERCOM3_CORE_Val
#define I2C_SERCOM_CLK_GEN 0
#define I2C_SERCOM_APBCMASK PM_APBCMASK_SERCOM3

```
Inside the function `initClockNVIC()` there is the following line:

`PM->APBCMASK.reg |= PM_APBCMASK_SERCOM0;`

Shouldn't this line use the define `I2C_SERCOM_APBCMASK` instead of the hardcoded SERCOM0 mask for the PM register?

Cheers!

Contributor guide

No contributing guide indexed for this repository

Research direction

Open board_driver_i2c.c and inspect initClockNVIC(), especially the PM->APBCMASK.reg assignment and the I2C_SERCOM_APBCMASK define. Verify the clock and mask configuration when I2C_SERCOM is changed from SERCOM0 to SERCOM3. Done means the selected SERCOM's mask is used instead of a hardcoded SERCOM0 mask.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.