Git Product home page Git Product logo

lempa's Introduction

LEMPA - Standalone MCU programmer for RPi

LEMPA is a combination of software and hardware that brings modern CI/CD practices to firmware flasging. Key features:

  • Fully open source hardware and software
  • No need for a computer, screen, or keyboard
  • LEMPA will fetch latest versions from cloud / local network automatically
  • Embedded web based 2-way serial monitor
  • Support for mulitiple controllers including the popular ATMega, ATTiny, and ESP
  • Web based interface
  • RESTful API for automation
  • Multi profile
  • Plugin based architecture that can used for automatic testing, embedding unique serial number etc.

Click image for short video: Click to watch

Image

LEMPA is composed of 3 parts:

Hardware: Raspberry PI HAT

A custom PCB that contains all the relevant connections required to program:

  • ATMega328 (including external oscillator)
  • ATTiny
  • ESP8266
  • Arduino mini pro
  • Any other ATMega controller via connector

I sell on Tindie

The board also includes:

  • LEDs for visual status (ready, downloading, programing, success, and error)
  • Jumper to define which profile to use.
  • LED for testing
  • Program / download button. Short click to program the MCU, long click to download latest version of the BINs from cloud / local network / shared folder.

Image Image

Software

The software reads the different profiles and orchestrates the process of downloading new BINs and programming Image

Installation instructions

  1. Download the software and extract it
  2. Install avrdude if needed sudo apt-get install avrdude
  3. Install prequisites: sudo apt-get install libopenjp2-7 and sudo apt-get install libtiff5
  4. Install required libraries pip3 install -r requirements.txt
  5. Make sure profiles.json reflects your environment
  6. python3 program.py or python3 program.py <profile id>
  7. Make sure you enable RPi interfaces: SPI, I2C, and Serial

Configuration: profiles.json

The configuration file can contain as many profiles as required.

  {
    "id": "blinklocal",
    "type": "bin",
    "jumper" : 1,
    "device": "m328p",
    "programmer": "linuxspi",
    "bins": [
      {
        "method": "local",
        "name": "blinklocal"
      }
    ],
    "fuses": {
      "lfuse": "0xF7",
      "hfuse": "0xD6",
      "efuse": "0xFD",
      "lock": "0xFF"
    },
    "plugins": [
      {
        "name": "serialinjector",
        "conf": {
          "serialSpeed": 38400,
          "fields": [
            {
              "id": "blinkrate",
              "value": 5,
              "title": "Blink rate in 100ms. For exampe value of 5 means 500ms off, 500ms on",
              "type": "byte"
            }
          ]
        }
      }
    ]

  },
...
]
  • id Unique ID for the profile
  • type bin or composite. Composite allows for multiple profile programming, one after another.
  • jumper optional If specified, and the relevant profile is chosen with a physical jumper, this profile will be used if none was specified as part of command line parameter.
  • device Type of device to program. Not required for ESP. See AVRDude for list of devices
  • autodetect If set to true, system will start programming as soon as it detects chip (does not work ESP)
  • bins List of bins to upload. For ATMega only one bin is required. For ESP multiple bins can be specified to support SPIFFS Bin method can be one of the following:
method description requred fields
cloud Fetch BIN from any URL url - source of the BIN
cloud_gw GW that will return info about the BIN. Usefull when a service is required in front of the BIN cloud storage info_url - End point of the service that will retun information about the BIN. The response of this URL must be a valid JSON with url field that points to the actual BIN
local Don't fetch. Valid BIN must be under bins folder. System will not actively fetch anything (none)
fs File system copy src - Path to source bin that needs to be copied
  • plugins System support a simple web server with the ability to send data to the ATMega via serial. This allows for parameter tweaking and QA.

Web Interface

Once LEMPA is up and running, It exposes web UI via port 8080 that allows:

  • Live view of system actions
  • Full working 2 way serial monitor. ATMega328 is connected by default to RPi serial0. External boards can be connected via dedicated headers on the HAT
  • Operation log
  • System control Image

Contact

Please contact me at [email protected] with any comments

lempa's People

Contributors

dependabot[bot] avatar rbenamotz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lempa's Issues

Button won't response if down before state loads

Describe the bug
Button won't response if down before state loads

To Reproduce
Steps to reproduce the behavior:

  1. Push prog button
  2. Start LEMPA (don't let go of the button)
  3. Release the button only when it enters the "wait for button" state

Expected behavior
Clicking on a prog button will.. prog but it does not respond

Remote I/O error

[Errno 121] Remote I/O error
Traceback (most recent call last):
File "./program.py", line 54, in
cycle()
File "./program.py", line 41, in cycle
event = state.do_step()
File "/home/pi/LEMPA/states/wait_for_button_state.py", line 39, in do_step
if self.button_erase.loop() or self.button_prog.loop():
File "/home/pi/LEMPA/states/hat_button.py", line 68, in loop
return self.__check_long_click()
File "/home/pi/LEMPA/states/hat_button.py", line 43, in __check_long_click
self.app.print(self.long_click_action_name + "? " + str(pt))
File "/home/pi/LEMPA/application.py", line 58, in print
v.print(txt)
File "/home/pi/LEMPA/views/display_view.py", line 88, in print
self.__refresh()
File "/home/pi/LEMPA/views/display_view.py", line 78, in __refresh
self.disp.display()
File "/home/pi/.local/lib/python3.7/site-packages/Adafruit_SSD1306/SSD1306.py", line 182, in display
self._i2c.writeList(control, self._buffer[i:i+16])
File "/home/pi/.local/lib/python3.7/site-packages/Adafruit_GPIO/I2C.py", line 127, in writeList
self._bus.write_i2c_block_data(self._address, register, data)
File "/home/pi/.local/lib/python3.7/site-packages/Adafruit_PureIO/smbus.py", line 364, in write_i2c_block_data
self._device.write(data)
OSError: [Errno 121] Remote I/O error

                          Exception

Traceback (most recent call last):
File "./program.py", line 54, in
cycle()
File "./program.py", line 41, in cycle
event = state.do_step()
File "/home/pi/LEMPA/states/wait_for_button_state.py", line 39, in do_step
if self.button_erase.loop() or self.button_prog.loop():
File "/home/pi/LEMPA/states/hat_button.py", line 68, in loop
return self.__check_long_click()
File "/home/pi/LEMPA/states/hat_button.py", line 43, in __check_long_click
self.app.print(self.long_click_action_name + "? " + str(pt))
File "/home/pi/LEMPA/application.py", line 58, in print
v.print(txt)
File "/home/pi/LEMPA/views/display_view.py", line 88, in print
self.__refresh()
File "/home/pi/LEMPA/views/display_view.py", line 78, in __refresh
self.disp.display()
File "/home/pi/.local/lib/python3.7/site-packages/Adafruit_SSD1306/SSD1306.py", line 182, in display
self._i2c.writeList(control, self._buffer[i:i+16])
File "/home/pi/.local/lib/python3.7/site-packages/Adafruit_GPIO/I2C.py", line 127, in writeList
self._bus.write_i2c_block_data(self._address, register, data)
File "/home/pi/.local/lib/python3.7/site-packages/Adafruit_PureIO/smbus.py", line 364, in write_i2c_block_data
self._device.write(data)
OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./program.py", line 62, in
state = load_state(Application.APP_STATE_EXCEPTION)
File "./program.py", line 31, in load_state
app.app_state = code
File "/home/pi/LEMPA/application.py", line 92, in app_state
v.header()
File "/home/pi/LEMPA/views/display_view.py", line 98, in header
self.__refresh()
File "/home/pi/LEMPA/views/display_view.py", line 78, in __refresh
self.disp.display()
File "/home/pi/.local/lib/python3.7/site-packages/Adafruit_SSD1306/SSD1306.py", line 168, in display
self.command(0) # Column start address. (0 = reset)
File "/home/pi/.local/lib/python3.7/site-packages/Adafruit_SSD1306/SSD1306.py", line 129, in command
self._i2c.write8(control, c)
File "/home/pi/.local/lib/python3.7/site-packages/Adafruit_GPIO/I2C.py", line 114, in write8
self._bus.write_byte_data(self._address, register, value)
File "/home/pi/.local/lib/python3.7/site-packages/Adafruit_PureIO/smbus.py", line 322, in write_byte_data
self._device.write(data)
OSError: [Errno 121] Remote I/O error

PCB Schematic?

I can't seem to find the actual schematic for the PCB?

I've been working on a kinda similar thing, designed around a USB<-->UART FT232 instead of a pi, and I'm curious how you're dealing with GPIO0 and 3V3 on the ESP to rest it properly and such things.
I've been planning to use the reset circuit off the D1 mini, but I'm curious as to how you approached it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.