Going Generic

Going Generic

Author's Contact Information

Generic_Author_image

Leo Chen

Recently, we have noticed an influx of interest concerning having our Linduino code work with a regular Arduino Uno. Here we will go over the modifications necessary, and the reasons behind these changes.

When Linduino was first conceived at Linear, we didn’t start by dreaming about building our own Arduino board. Our initial focus was simply on code. We eventually realized that in order to provide a robust isolation scheme we would have to build our own board, but that came later.

The intention from the beginning was for all our code to be as compatible as possible with a standard off the shelf Arduino Uno. We had to insert some Linduino specific code in order to interface the Linduino One to our standard QuikEval demo boards, however this is a simple modification to undo.

LTC QuikEval boards all contain an identity EEPROM. This EEPROM contains a specific string that our software attempts to sniff out and is on its own I2C bus. This is why the Linduino One has a mux on the front end. In order to make Linduino code run properly on a standard Arduino Uno, the user just has to find this specific identity and mux code, and properly modify it. All the modifications take place in the .ino file of the part in question.

For this article we will use the LTC2991 code as an example. This way we can reference line numbers easily. Please refer to the .ino file which can be found here: http://www.analog.com/en/products/monitor-control-protection/power-monitors/ltc2991.html#product-tools.

The first line of code that needs to be modified is on line 152. This line calls the function quikeval_I2C_connect().

If you do some digging into the LT_I2C.cpp file found inside of the sketchbook, you can see that this function merely switches the pins that control the mux on the front end of the Linduino One. On a standard Arduino Uno, we do not need this to happen. So go ahead and comment out that line of code. On SPI devices quikeval_SPI_connect() will be called and should be commented out instead.

The next modification occurs on line 155:

demo_board_connected = discover_demo_board(demo_name); //!Checks if correct demo board is connected.

This line of code calls the discover_demo_board() function and is meant to reach out on the AUX I2C bus and tickle the EEPROM on the other end. Except, in the case of a standard Arduino Uno, there is no AUX I2C bus and this function will always give us a FALSE return which will then result in nothing happening except for an error message.

To correct this, comment out this line and add this line under it:

demo_board_connected = true;

Now, this code is Arduino Uno compatible. Two lines, two changes, pretty simple. Obviously the line numbers will vary from .ino file to .ino file, but the general idea will be the same. Hunt down the line that calls either quikeval_SPI_connect() or quikeval_I2C_connect() and comment that one out. Then, make sure that demo_board_connected is always true.

Of course, none of this really matters unless the I2C/SPI lines are connected properly from demo board to Arduino Uno. This list of pin-outs for the Arduino connectors are as follows:

SDA: A4
SCL: A5

SPI:
_CS: ~10
SCK: 13
MOSI/SDI: ~11 MISO/SDO: 12

Meet Linduino