OBootLin

OBootLin is a software that allows to download into the OSIMPLC’s Flash memory, the *.hex file containing the machine code compiled from Ladder scheme (*.ld file) by LDmicro, or generated by another programming software and its compiler.
OBootLin runs on GNU/Linux Operative Systems, and is GPLv2 licensed.

OBootLin is a slightly modified version of TinyBootloaderLin, and it uses firmware adapted for OSIMPLC preinstalled microcontrollers: PIC16F887 (standard) and PIC18F4520 (alternative), with 20 MHz external crystal oscilator.

These firmwares are totally compatible with other free and privative softwares which can perform the same task, all of them derived from the original Tiny Pic Bootloader TPBL: TinyBootloaderLin (original and fork), under GNU/Linux O.S.; TPBLwin and MultiBootloader+, under Windows O.S.


Installing ObootLin

Downloading ObootLin

From OSIMPLC Downloads page, download OBootLin.zip file.

Required dependencies:

Arch Linux:

python python-pyserial python-wxpython

Debian, Ubuntu y derivatives

python3 python3-serial python3-wxgtk4.0

Fedora:

python3 python3-pyserial python3-wxpython4

Install

No special process is required to install OBootLin.
Simply, decompressing the obootlin.zip archive onto a new subdirectory inside /home/$USER directory (preferably aside LDmicro subdirectory).


Using OBootLin

Communication between OSIMPLC and PC:

  1. Connect the OSIMPLC Programming Cable, or a generic USB-TTL adapter, to USB port in PC and to TTL connector (pinout) in OSIMPLC.
    In GNU/Linux, the programming cable or the adapter will appear as /dev/ttyUSB[0-9] device.

  2. Check port assignement:

[$USER@$hostname ~]$ ls -l /dev | grep ttyUSB  
crw-rw----  1 root uucp    188,   0 mar  2 13:13 ttyUSB0  

Note: if another USB-serial adapter is previously connected, the programming cable or new adapter will be renumbered to /dev/ttyUSB1, and so on.

IMPORTANT:

User must be added to the group that allows USB serial access (root permissions required):
Arch Linux and others (Fedora, openSUSE): uucp group.
Debian, Ubuntu and derivatives: dialout and plugdev groups.

Executing OBootLin

  1. In a virtual terminal, change to Obootlin directory:
    [$USER@$hostname ~]$ cd /home/$USER/../ObootLin/

  2. Execute OBootLin by means python3:
    [$USER@$hostname ObootLin]$ python3 tinybldlin.py

  3. As alternative, generaten OBootLin.desktop launcher that allows automatic execution of OBootLin, without de need to do it from virtual terminal.
    Copies of OBootLin.desktop file can be installed in different user’s subdirectories: (Desktop) and/or others.
    Use a text editor to copy and modify the following launcher example: OBootLin.desktop

     [Desktop Entry]  
     Name=OBootLin  
     Exec=/home/$USER/path/to/OBootLin/obootlin.py  
     Type=Application  
     StartupNotify=true  
     Path=/home/$USER/path/to/OBootLin/  
     Icon=/home/$USER/path/to/OBootLin/modules/images/obootlin.png  

Configuring port and baudrate in OBootLin graphical interface:

In configuration Section (left down) in OBootLin:

  1. Baudrate: Select 19200 in Comm dropdown list (by default, obootlin.py uses 19200 baud for programming and checking).
  2. Port search: press the Search button, Comm text /dev/ttyUSB[0-9] will show the virtual port (7dev/ttyUSB[0-9] assigned to programming cable or USB-TTL generic adapter. If an error arise, it will show the message “No serial ports detected”.
  3. Comm text field: alternativatelly, port /dev/ttyUSB[0-9] can be manually set, following O.S. assignation (see above: Check port assignement).
  4. Is convenient to mark the opción Check File option, to avoid corrupted or inexistent program transferring.
  5. If programming cable or generic USB-TTL adapter is used, it is not necessary to mark the RTS (RequestToSend) option; this only would be required for communication through native serial port (DB9 ttyS[0-3]), actually deprecated.

Check OSIMPLC communication and identification:

  1. In OBootLin command section (left above) press the CheckPIC button, while progress bar is running (timeout), press and release the RESET button in OSIMPLC.

  2. If operation is succefully, Messages Tab will show:

  Connected to /dev/ttyUSB0 at 19200  
  Searching for PIC ...  
  Found:16F 886/887 [18F 452o]  
  1. If error arise, it will show the message: “Could not connect to ttyUSB0 at 19200 ERROR!” if communication with programming cable or USB-TTL adapter can not be established;
    or the message: “Connected to /dev/ttyUSB0 at 19200 Searching for PIC… Not found ERROR!” if OSIMPLC has no power supply, is still reseted, or there is any other problem.

Write Flash: Transfer the user program (machine code compiled) into OSIMPLC:

  1. Select *.hex file to transfer (compiled by LDmicro or another programming software) using the Browse button (right above). A SelectHexFile dialog will open, allowing directories tree navigation, and selection of the desired file containing the corresponding user program.

  2. In OBootLin command section (left above), press the Write Flash button, while progress bar is running (timeout), press and release the RESET button in OSIMPLC.

  3. If operation is succefully, Messages Tab will show:

 Connected to /dev/ttyUSB0 at 19200  
 HEX:xx days old,INX32M,16Fcode+cfg,total=xxxx bytes.  
 Searching for PIC ...  
 Found:16F 886/887  
 Write OK at hh:mm time: x.xxx sec  
  1. If error arise, it will show the message: “Could not connect to ttyUSB0 at 19200 ERROR!” if communication with programming cable or USB-TTL adapter can not be established;
    or the message: “Connected to /dev/ttyUSB0 at 19200 HEX:xx days old,INX32M,16Fcode+cfg,total=xxx bytes. Searching for PIC …Not found”, if OSIMPLC has no power supply, is still reseted, or there is any other problem.

Use of included virtual terminal to send and receive data from OSIMPLC:

NOTE: To communicate OSIMPLC with PC, programming cable, USB-TTL or USB-RS485 adapters can be used.**

  1. In Terminal tab: Select data baudrate in using dropdown list.
    NOTE: user program data baudrate through UART can be different from OSIMPLC programming and check baudrate, it must be defined in LDmicro MCU parameters menu (or in menus/settings in other softwares).

  2. Opening communication: Press Open button.

  3. Receiving data:
    If OSIMPLC is sending data though ist serial ports (TTL or RS-485), they will be displayed in text field.
    Using Rx dropdown list, user can see data as Char (character) or Hex codes.
    Being open the comm port, user can select and copy chunks of the text field contents.

  4. Sending data:
    Using Tx dropdown list, user can send data as Char (character).
    User can type chars in Tx text field, or copy/paste from a file and paste on it.
    After that, Send button or Enter in keyboard must be pressed to execute transmission.
    Other types of data can be sent (char\ , Type, TypEcho).

  5. Closing communication: Press Close button.


Software history

[OBootlin]

https://github.com/osimplc/obootlin

This forked code is a stripped and slightly modified version from Tiny Pic Bootloader for GNU/Linux, Luis Claudio Gamboa fork.

It has a modified pictype.py module, with only PIC16F887 and 18F4520 microcontrollers identifiers.
Also, it has only the firmware for PIC16F887 and 18F4520 microcontrollers, running at 20 MHz on external crystal oscillator.

Tiny Pic Bootloader for GNU/Linux, Luis Claudio Gamboa fork

https://github.com/lcgamboa/tinybldlin

This forked code is a modified version to handle different bootloader sizes defined by user in file “modules/pictype.py”.

Latest commit: d7cf21b, 2018-12-16.
Conversion to python3.

Tiny Pic Bootloader for GNU/Linux

http://tinybldlin.sourceforge.net/

The original Tiny Pic Bootloader for GNU/Linux was writed by Fernando Juarez V.
Tiny Pic Bootloader for GNU/Linux is licensed under GPL v2.

TinybldLin has been writted in python using python-serial module and wxphython; it can be run on any linux distro (and maybe mac) who has installed those dependencies.

“This port pretend to be more than a clone of the original tinybldWin.exe; it pretends, in the future, add new futures and enhaces the original ones.”

Latest version: tinybldlin-0.8.1-src.tar.gz, 2012-11-15.

Tiny Pic Bootloader for Windows

http://www.etc.ugal.ro/cchiculita/software/picbootloader.htm

Tiny Pic Bootloader for Windows (tinybld) was writed by Claudiu Chiculita, whom developed the firmware and the first versions (under Delphi) for Windows OS.

tinybld firmwares are the smallest bootloaders available for PICs, they occupy 100 words max. (200 bytes) for devices from 16F, 18F, dsPIC30 families that have self-programming support.

Tiny Pic Bootloader for Windows is free (as No Cost) software, but it has not a Free (as Libre) Software license, nor its source code is available.

Latest version: TinyBld-1_10_6_pc_beta.zip, 2011-06-18.