From 89a9552b5b360a364050bf872b98b74f20d5134c Mon Sep 17 00:00:00 2001 From: Galen Nickel Date: Mon, 16 Sep 2019 11:42:58 -0700 Subject: [PATCH] I2C Addressing Note (#2428) * I2C on-board sensor address note * note for 7bit to 8bit shift --- docs/reference/pins/i2c-read-buffer.md | 10 ++++++++++ docs/reference/pins/i2c-read-number.md | 10 ++++++++++ docs/reference/pins/i2c-write-buffer.md | 10 ++++++++++ docs/reference/pins/i2c-write-number.md | 9 +++++++++ 4 files changed, 39 insertions(+) diff --git a/docs/reference/pins/i2c-read-buffer.md b/docs/reference/pins/i2c-read-buffer.md index 1c0764b8..ccbddfcb 100644 --- a/docs/reference/pins/i2c-read-buffer.md +++ b/docs/reference/pins/i2c-read-buffer.md @@ -22,8 +22,18 @@ A device connected to the I2C pins on the @boardname@ at the address is selected ### ~ hint +#### Repeated start + A [repeated start condition](http://www.i2c-bus.org/repeated-start-condition/) is set to help make sure that when you want to read data miltiple times from the device at once, it can happen without interruption. A start conditon is sent (if **repeated** is `true`) each time a buffer is read without a matching stop condition. When the last buffer is read, the stop conditon can be sent by setting **repeated** to `false`. For single reads, don't use **repeated** or set it to `false`. +#### Reserved addresses + +Some sensors on your @boardname@ use the same I2C bus that is connected to the pins that you program. This means that you should be careful to **NOT** use an address for your device that is the same as the any of the ones used by the sensors on the board. Check the [I2C sensor addresses](https://tech.microbit.org/hardware/i2c/) list before you assign one to your device. This will help you keep the addresses separate. + +#### Bus address format + +The @boardname@ uses 7-bit values to address the devices connected on the I2C bus. Before an address is transmitted, it is adjusted temporarily to an 8-bit value so that the valid address bits are sent properly. This means that the value of an 8-bit address present on the bus will appear as twice that of what you specified. This is fine though, since the device you are addressing will decode it to match the address you gave. If your device address is specified as an 8-bit address, you will need to use an address that is half that value when you read to or write from it. + ### ~ ## Returns diff --git a/docs/reference/pins/i2c-read-number.md b/docs/reference/pins/i2c-read-number.md index 5bab2937..d27e5d2b 100644 --- a/docs/reference/pins/i2c-read-number.md +++ b/docs/reference/pins/i2c-read-number.md @@ -20,8 +20,18 @@ pins.i2cReadNumber(0, NumberFormat.Int8LE, false); ### ~ hint +#### Repeated start + A [repeated start condition](http://www.i2c-bus.org/repeated-start-condition/) is set to help make sure that when you want to read multiple numbers from the device at one time, it can happen without interruption. A start conditon is sent (if **repeated** is `true`) each time a number is read without a matching stop condition. When the last number is read, the stop conditon can be sent by setting **repeated** to `false`. For single reads, don't use **repeated** or set it to `false`. +#### Reserved addresses + +Some sensors on your @boardname@ use the same I2C bus that is connected to the pins that you program. This means that you should be careful to **NOT** use an address for your device that is the same as the any of the ones used by the sensors on the board. Check the [I2C sensor addresses](https://tech.microbit.org/hardware/i2c/) list before you assign one to your device. This will help you keep the addresses separate. + +#### Bus address format + +The @boardname@ uses 7-bit values to address the devices connected on the I2C bus. Before an address is transmitted, it is adjusted temporarily to an 8-bit value so that the valid address bits are sent properly. This means that the value of an 8-bit address present on the bus will appear as twice that of what you specified. This is fine though, since the device you are addressing will decode it to match the address you gave. If your device address is specified as an 8-bit address, you will need to use an address that is half that value when you read to or write from it. + ### ~ ## Returns diff --git a/docs/reference/pins/i2c-write-buffer.md b/docs/reference/pins/i2c-write-buffer.md index cfd9a33a..58e66d7e 100644 --- a/docs/reference/pins/i2c-write-buffer.md +++ b/docs/reference/pins/i2c-write-buffer.md @@ -22,8 +22,18 @@ A device connected to the I2C pins on the @boardname@ at the address is selected ### ~ hint +#### Repeated start + A [repeated start condition](http://www.i2c-bus.org/repeated-start-condition/) is set to help make sure that when you want to write data miltiple times from the device at once, it can happen without interruption. A start conditon is sent (if **repeated** is `true`) each time a buffer is written without a matching stop condition. When the last buffer is written, the stop conditon can be sent by setting **repeated** to `false`. For single writes, don't use **repeated** or set it to `false`. +#### Reserved addresses + +Some sensors on your @boardname@ use the same I2C bus that is connected to the pins that you program. This means that you should be careful to **NOT** use an address for your device that is the same as the any of the ones used by the sensors on the board. Check the [I2C sensor addresses](https://tech.microbit.org/hardware/i2c/) list before you assign one to your device. This will help you keep the addresses separate. + +#### Bus address format + +The @boardname@ uses 7-bit values to address the devices connected on the I2C bus. Before an address is transmitted, it is adjusted temporarily to an 8-bit value so that the valid address bits are sent properly. This means that the value of an 8-bit address present on the bus will appear as twice that of what you specified. This is fine though, since the device you are addressing will decode it to match the address you gave. If your device address is specified as an 8-bit address, you will need to use an address that is half that value when you read to or write from it. + ### ~ ## Example diff --git a/docs/reference/pins/i2c-write-number.md b/docs/reference/pins/i2c-write-number.md index 0015839a..b630d9ee 100644 --- a/docs/reference/pins/i2c-write-number.md +++ b/docs/reference/pins/i2c-write-number.md @@ -21,8 +21,17 @@ pins.i2cWriteNumber(0, 0, NumberFormat.Int8LE, true); ### ~ hint +#### Repeated start + A [repeated start condition](http://www.i2c-bus.org/repeated-start-condition/) is set to help make sure that when you want to write multiple numbers from the device at one time, it can happen without interruption. A start conditon is sent (if **repeated** is `true`) each time a number is written without a matching stop condition. When the last number is written, the stop conditon can be sent by setting **repeated** to `false`. For single writes, don't use **repeated** or set it to `false`. +#### Reserved addresses + +Some sensors on your @boardname@ use the same I2C bus that is connected to the pins that you program. This means that you should be careful to **NOT** use an address for your device that is the same as the any of the ones used by the sensors on the board. Check the [I2C sensor addresses](https://tech.microbit.org/hardware/i2c/) list before you assign one to your device. This will help you keep the addresses separate. + +#### Bus address format + +The @boardname@ uses 7-bit values to address the devices connected on the I2C bus. Before an address is transmitted, it is adjusted temporarily to an 8-bit value so that the valid address bits are sent properly. This means that the value of an 8-bit address present on the bus will appear as twice that of what you specified. This is fine though, since the device you are addressing will decode it to match the address you gave. If your device address is specified as an 8-bit address, you will need to use an address that is half that value when you read to or write from it. ### ~ ## Examples