Skip to content

Commit

Permalink
Fix default I²C pins with Pin Control definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
koenvervloesem committed Aug 29, 2023
1 parent 1bb7809 commit d7c297b
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@
* Device address 0x76 is assumed. Your device may have a different
* address; check your device documentation if unsure.
*/
&pinctrl {
i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 31)>,
<NRF_PSEL(TWIM_SCL, 0, 29)>;
};
};

i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 31)>,
<NRF_PSEL(TWIM_SCL, 0, 29)>;
low-power-enable;
};
};
};

&i2c0 {
status = "okay";
bme280@76 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@
* Device address 0x76 is assumed. Your device may have a different
* address; check your device documentation if unsure.
*/
&pinctrl {
i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 31)>,
<NRF_PSEL(TWIM_SCL, 0, 29)>;
};
};

i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 31)>,
<NRF_PSEL(TWIM_SCL, 0, 29)>;
low-power-enable;
};
};
};

&i2c0 {
status = "okay";
bme280@76 {
Expand Down
17 changes: 17 additions & 0 deletions 4-connections/zephyr/peripheral_bme280/nrf52840dk_nrf52840.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@
* Device address 0x76 is assumed. Your device may have a different
* address; check your device documentation if unsure.
*/
&pinctrl {
i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 31)>,
<NRF_PSEL(TWIM_SCL, 0, 29)>;
};
};

i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 31)>,
<NRF_PSEL(TWIM_SCL, 0, 29)>;
low-power-enable;
};
};
};

&i2c0 {
status = "okay";
bme280@76 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@
* Device address 0x76 is assumed. Your device may have a different
* address; check your device documentation if unsure.
*/
&pinctrl {
i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 31)>,
<NRF_PSEL(TWIM_SCL, 0, 29)>;
};
};

i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 31)>,
<NRF_PSEL(TWIM_SCL, 0, 29)>;
low-power-enable;
};
};
};

&i2c0 {
status = "okay";
bme280@76 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@
* Device address 0x76 is assumed. Your device may have a different
* address; check your device documentation if unsure.
*/
&pinctrl {
i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 31)>,
<NRF_PSEL(TWIM_SCL, 0, 29)>;
};
};

i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 31)>,
<NRF_PSEL(TWIM_SCL, 0, 29)>;
low-power-enable;
};
};
};

&i2c0 {
status = "okay";
bme280@76 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@
* Device address 0x76 is assumed. Your device may have a different
* address; check your device documentation if unsure.
*/
&pinctrl {
i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 31)>,
<NRF_PSEL(TWIM_SCL, 0, 29)>;
};
};

i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 31)>,
<NRF_PSEL(TWIM_SCL, 0, 29)>;
low-power-enable;
};
};
};

&i2c0 {
status = "okay";
bme280@76 {
Expand Down
2 changes: 1 addition & 1 deletion ERRATA.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Chapter 3: Broadcasting data with advertisements
* page 77: The sentence beginning with "if you look up its definition" should start with a capital letter: "If you look up its definition".
* page 78: The sentence "The ``BT_LE_ADV_PARAM`` macro is another helper macro:" shouldn't be in the code block, but on a normal line, referring to the rest of the code block.
* page 82: Connect pin 0.26 of the nRF52840 Dongle to SDA and 0.27 to SCL.
* page 84: Remove the definitions ``sda-pin``, ``scl-pin``, and ``label`` from the devicetree overlay. The nRF52840 Dongle's devicetree has already defined an I²C bus with SDA pin 0.26 and SCL pin 0.27. The same holds for the nRF52840 Development Kit's devicetree overlay. This is fixed in the code in this repository. The sentences "This overlay defines a BME280 sensor on the I²C bus with SDA pin 31 and SCL pin 29, with address 0x76. So, with this overlay, you can use the BME280 sensor connected to pins 0.31 (SDA) and 0.29 (SCL)." should read "This overlay defines a BME280 sensor on the I²C bus 0, which by default assigns SDA to pin 0.26 and SCL to pin 0.27, with address 0x76. So, with this overlay, you can use the BME280 sensor connected to pins 0.26 (SDA) and 0.27 (SCL)."
* page 84: Remove the definitions ``sda-pin``, ``scl-pin``, and ``label`` from the devicetree overlay and add Pin Control definitions to change the default pins of the I²C bus to 0.31 (SDA) and 0.29 (SDA). This is fixed in the code in this repository.

******************************************
Chapter 7: Reverse engineering BLE devices
Expand Down

0 comments on commit d7c297b

Please sign in to comment.