Arduino notes
Jump to navigation
Jump to search
Getting started:
- https://playground.arduino.cc/Learning/CommandLine . . . mentions PlatformIO "ecosystem" and specific Linux ready command line tools for working with Arduino
- https://www.youtube.com/watch?v=qAM2S27FWAI . . . avr-dude and related tools can program Arduino Uno boards
- https://playground.arduino.cc/OpenBSD/CLI . . . Arduino development work on OpenBSD systems
The ATMEGA328P processor used in Arduino Uno boards:
- http://www.microchip.com/wwwproducts/en/ATmega328p . . . the ATMEGA328P processor used in Arduino Uno boards
Specific Arduino projects:
- https://www.hackster.io/niesse/water-level-ultrasonic-sensor-with-lorawan-c2cf55
- https://www.arduino.cc/en/Tutorial/HelloWorld
FreeRTOS port to Arduino:
Arduino Wire Library
2018-05-21 - Monday, looking at /usr/share/arduino/libraries/Wire/utility/twi.c, routine twi_writeTo() error codes:
177 /*
178 * Function twi_writeTo
179 * Desc attempts to become twi bus master and write a
180 * series of bytes to a device on the bus
181 * Input address: 7bit i2c device address
182 * data: pointer to byte array
183 * length: number of bytes in array
184 * wait: boolean indicating to wait for write or not
185 * sendStop: boolean indicating whether or not to send a stop at the end
186 * Output 0 .. success
187 * 1 .. length to long for buffer
188 * 2 .. address send, NACK received
189 * 3 .. data send, NACK received
190 * 4 .. other twi error (lost bus arbitration, bus error, ..)
191 */
192 uint8_t twi_writeTo(uint8_t address, uint8_t* data, uint8_t length, uint8_t wait, uint8_t sendStop)
193 {
194 uint8_t i;
195
196 // ensure data will fit into buffer
197 if(TWI_BUFFER_LENGTH < length){
198 return 1;
199 }
.
.
.
According to the oscilloscope the I2C communications are running at about 192kHz, a little fast. Here is documentation at the Arduino site about setting the I2C clock rate:
- https://www.arduino.cc/en/Reference/WireSetClock . . . Wire.setClock() class method not found on localhost!
Another place where SCL frequency may be set . . .
user@localhost:/usr/share/arduino/libraries/Wire$ grep -nr lock ./* ./Wire.cpp:84: // perform blocking read into buffer ./Wire.cpp:139: // transmit buffer (blocking) ./utility/twi.c:85: SCL Frequency = CPU Clock Frequency / (16 + (2 * TWBR)) ./utility/twi.c:467: // sends ack and stops interface for clock stretching
2022-06-13
OpenMV IDE and Arduino Nano: