Arduino Core API module Documentation
This module provides an abstraction layer that enables Arduino IDE style C++ code to use underlying zephyr OS to program an Arduino BLE Sense 33. This project is still under development stage.
Arduino Nano ble sense 33
The pinout for the arduino board that I am testing this project on is given below:
The reason for choosing this board is that it is widely available and the chip Nordic nRF52x supports zephyr natively in their SDK.
GPIOs
TODO: Documentation
Serial
TODO: implement
I2C
I2C implementation needed me to dive into the basics of the protocol itself. Here’s the live demo of a stream of X Y Z Co-ordinates coming from the ADXL345 connected to the arduino over I2C.
We can see that there are 2 wires required in I2C - SDA and SCL. The SDA line carries data and SCL carries the clock pulse. To understand better, here’s(/assets/images/LA_i2c_view1.png) what was actually going on at a logic level.
Wire.beginTransmission(0x53)
stores the address0x53
in a local variable_address
.Wire.write(0x2C)
andWire.write(0x08)
append data to be written to thetxBuffer
inside the arduino.Finally,
Wire.endTransmission();
actually transfers the data (contents oftxBuffer
) over i2c to the ADXL345.Wire.requestFrom(0x53, 1)
takes in theaddress
(here, 0x53), andlen
which is the length of bytes needed. Data is then read over i2c from the ADXL345 and appended/ stored in a ring buffer. A Ring Buffer is a Circular Buffer in Zephyr and can be used for applications where a fixed size array doesn’t suffice.Wire.read()
finally returns the first element stored in the ringbuffer and pops it from there. In the waveform(/assets/images/LA_i2c_view2.png
), we can see the response coming from ADXL as0x03
.
ADXL345 Testing Done.