Skip to content

Commit 14d6162

Browse files
Merge pull request #14 from microbit-foundation/v2-branch
Spec V2.00
2 parents 63d14ee + 3f3903c commit 14d6162

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

spec/index.md

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ lang: en
1010

1111
# micro:bit I2C Protocol Specification
1212

13-
This is version 1.01 of the specification.
13+
This is version 2.00 of the specification.
1414

1515
- [Glossary](#glossary)
1616
- [Versioning](#versioning)
@@ -21,6 +21,7 @@ This is version 1.01 of the specification.
2121
- [I2C HID Interface](#i2c-hid-interface)
2222
- [Doc Updates](#doc-updates)
2323

24+
2425
## Glossary
2526

2627
| Term | Definition |
@@ -237,6 +238,8 @@ Value only includes major version
237238
| Read property disallowed | 0x36 |
238239
| Write property disallowed | 0x37 |
239240
| Write fail | 0x38 |
241+
| Busy | 0x39 |
242+
240243

241244
### Examples
242245

@@ -252,19 +255,24 @@ Value only includes major version
252255
- The main (nRF) must wait for the `COMBINED_SENSOR_INT` signal to be asserted by the secondary (KL27)
253256
- `write_request` can be sent by both secondary and main.
254257
- For the secondary to initiate this, it must assert the interrupt signal first and then the main must poll (i2c read) the device for data.
258+
- I2C transactions must not overlap. Every I2C Write, must be followed by an I2C Read.
259+
- I2C Reads can be triggered by other I2C devices activating the shared `COMBINED_SENSOR_INT` interrupt signal. In case a response is not ready by the secondary (KL27), the busy error code will be returned and the main (nRF) should re-attempt to read the response when the `COMBINED_SENSOR_INT` signal is asserted.
255260

256261

257262
## I2C Flash interface
258263

259264
KL27 storage memory layout:
260265

261266
```
262-
↓ KL27 flash address 0x20000 ↓ KL27 flash address0x40000
267+
↓ KL27 flash address 0x20000 ↓ KL27 flash address 0x40000
263268
↓ ↓ KL27 flash address 0x20400 ↓
264269
┌---------┬-------------------------------------------------┐
265-
|[config] |[data [ DAL’s config ]]|
270+
| KL27 | storage data |
271+
| config |[ file.ext -------------------- ][ DAL’s config ]|
266272
└---------┴-------------------------------------------------┘
267-
↑ storage address 0x0000 ↑ storage address set by file size
273+
↑ storage address 0x0000 ↑ address set by file size
274+
↑ encoding window start address (anywhere inside file.ext range)
275+
↑ encoding window end address (anywhere inside file.ext range)
268276
```
269277

270278
- config
@@ -289,13 +297,23 @@ KL27 storage memory layout:
289297
- File name (includes extension) (cmd id `0x01`)
290298
- 11B uppercase characters following 8.3 format (e.g. `"DATA BIN"`)
291299
- default → DATA.BIN
300+
- A remount is needed for the file name change to take effect
292301
- File size (from start of data section) (`0x02`)
293302
- 4B size in bytes (MSB First)
294-
- default → 126 KBs
303+
- default → 129024 (126 KBs)
295304
- max size is 126 KBs (128KB - 1KB for flash interface config and 1KB for DAL's config)
305+
- A remount is needed for the file size change to take effect
306+
- Set encoding window (`0x09`)
307+
- 4B Encoding window start (MSB First)
308+
- 4B Encoding window end (MSB First)
309+
- default → 0 for both values
310+
- min value is 0, max value is the end of file adress
311+
- If encoding window start is equal to encoding window end, no encoding will be done
312+
- A remount is needed for the encoding window to take effect
296313
- Enable file visible in MSD (`0x03`)
297314
- 1B visibility
298315
- default → false
316+
- A remount is needed for the file visibility change to take effect
299317
- Write config data to flash (`0x04`)
300318
- Handles sector erase if RAM config data is different than Flash config data
301319
- Erase all config (`0x05`)
@@ -402,6 +420,15 @@ KL27 storage memory layout:
402420
I2C Addr ↑ cmd id ↑
403421
```
404422

423+
#### Set encoding window
424+
- Set encoding window to first 1KB
425+
```
426+
I2C Write: [0x72, 0x09, 0x00,0x00,0x00,0x00, 0x00,0x00,0x04,0x00]]
427+
I2C Addr ↑ cmd id ↑ enc window start ↑ enc window end ↑
428+
I2C Read: [0x72, 0x09, 0x00,0x00,0x00,0x00, 0x00,0x00,0x04,0x00]]
429+
I2C Addr ↑ cmd id ↑ enc window start ↑ enc window end ↑
430+
```
431+
405432
### Universal Hex
406433

407434
KL27 storage area should be writeable via Universal Hex.
@@ -422,3 +449,5 @@ This is not yet implemented.
422449
|---------|---------|
423450
| 1.00 | Initial release, as implemented in DAPLink 0255 |
424451
| 1.01 | Add note to "Power state" property about the hardware issue detecting battery power when USB power is present. |
452+
| 2.00 | Add busy flag error code |
453+
| | Add "Set encoding window" command to the I2C Flash interface [PR #9](https://github.com/microbit-foundation/spec-i2c-protocol/pull/9) |

0 commit comments

Comments
 (0)