AC.programmer: Difference between revisions

From IoT with AME
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
[[Tools]]
[[Tools]], [[My_IoT_projects|My IoT Projects]]


=AC.programmer=
=AC.programmer=
Line 42: Line 42:
[[file:20170802T120644 scaled.jpg|left|thumb|300px|Version 2 - With LCD and I2C log facility]]
[[file:20170802T120644 scaled.jpg|left|thumb|300px|Version 2 - With LCD and I2C log facility]]


[[Tools]]
[[Tools]], [[My_IoT_projects|My IoT Projects]]

Revision as of 10:05, 8 June 2018

Tools, My IoT Projects

AC.programmer

AC.programmer is simply an Arduino as an ISP (In System Programmer) with some added bells and whistles.

ISP programming does not use the serial interface of the Arduino and does not require a pre-installed boat loader. Instead, the programmer uses the SPI interface to communicate which the target that has been switched into serial programming mode on reset.

Freeing up the serial interface for communications with the ESP8266 WLAN chip was the main reason for me to use an ISP. SoftwareSerial is slow, and even at slow speeds it means asking for trouble (lost characters, in example).

Another advantage of SPI programming is that it frees up the 2kB of flash memory that the boot loader occupies, all yours to use! This is the only way to get to access all the 32kB of flash memory the smaller Arduinos have to offer. Here (todo: provide link) is an entry for boards.txt of the Arduino IDE that reflects the gain in memory.

There is one disadvantage, though: Without having the serial interface connected to your computer, you loose that option for logging. I developed a logging facility called "Logsury" that, amongst other channels, can log via I2C. AC.programmer forwards log information received via I2C to its own serial interface (connected to the computer), and/ or displays it on its large LCD display, or logs it to a file store on a SD Card (or any combination thereof).

LCDs for Arduino often use up pretty much all port pins. Plugging the display directly into an Arduino Uno is convenient but makes all the decisions for you (like, using up the SPI connections to communicate with the SD card often found on the display).

Plus, not all connections are needed. If you have only one LCD, "chip select" can simply be tied to 5V. If you don't need to read from display RAM, you don't need the "read mode" pin. You will need the "command/data", "write mode", and "reset" pins, plus, of cause, 8 data pins.

Unless you use a shift register to supply data. This is quite a bit slower (by a factor of about 4), but it saves you 6 port pins as you only need "data" and "clock" to operate the shift register. By clever placement of parts this, too, saves quite a bit of wiring as well. That's what I did.

What should the programmer offer? I want

  • that it works (duh)
  • it to be fast. It is possible to crank up the speed between computer and programmer to 115200baud and between programmer and target to whatever the target can handle.
  • information on the programming process. "Arduino as ISP" uses 3 LEDs to provide status information. We have a whole LCD display. If something goes wrong, I can say exactly what. During programming, I can display what is written where (pages of flash and EEPROM memory).
  • a way to load data into EEPROM memory, if my application needs it. Preconfigured WLAN settings for multiple SSIDs come to mind...
  • it to run on battery power. When I'm "in the field", I want to be able to update devices without a connection to the grid.
  • to power the target. I have fried a number of Arduinos by connecting them and the programmer to different power sources in ways that were clearly less than optimal.
  • it to upload programs from SD card. Again, when I'm "in the field", I don't want to lug around a whole laptop just to program devices the memory of which could not even hold one of the colorful desktop icons.
  • some fun, like information on what exactly the Arduino IDE is sending to and receiving from the programmer.

Sketching a plan:

  • Display log messages on the LCD
  • Log IDE/programmer and programmer/target interaction
  • First, get the whole thing to work (program a target)
  • Visually display the programming progress. In example, display bars or rectangles that represent the flash and EEPROM pages and show what is being read and being written. Ditto the fuses.
  • On request, show the signature of the target, fuse bit values.
  • Change parameters via the touch screen (like, the SPI speed)
Version 1 - Just the plain programmer
Version 2 - With LCD and I2C log facility

Tools, My IoT Projects