BE-IIS-HPP-LIN
Two isolated LIN channels for Raspberry Pi โ from direct LIN access to custom application logic.
MPN: BE-IIS-HPP-LIN
What is the BE-IIS-HPP-LIN?
The BE-IIS-HPP-LIN is a HAT++ for LIN communication with two galvanically isolated LIN channels.
A microcontroller on the board handles time-critical LIN communication. Linux therefore does not have to generate LIN timing or react to individual bus events in real time.
The software deliberately comprises several layers. Depending on the application, you can work close to the hardware or at a higher application level.
Software layers
C or Python application on Linux
|
| Unix socket
v
beiis-lind
|
| Runtime data + GPIO6 interrupt
v
Queries / application workers
|
v
Direct MicroPython
|
v
Native C LIN module
|
v
LIN1 / LIN2
Layer 1 โ Native C LIN module
The native C module is the lowest software layer. It performs time-critical LIN functions:
- Initialize LIN.
- Transmit a master frame.
- Request a slave response.
- Provide a slave response.
- Receive master-published data as a slave.
- Handle checksums and bus timing.
This layer is part of the firmware. Changes require modifying and rebuilding the firmware.
Use it for: New time-critical LIN functions or functionality that belongs directly in the firmware.
Layer 2 โ Direct MicroPython access
For users, the MicroPython lin module is the lowest convenient access layer.
import lin
lin.init(1, 19200)
lin.send(1, 0x12, b"\x11\x22\x33\x44", True)
data = lin.request(1, 0x22, 4, True)
MicroPython calls the native C LIN module. LIN timing therefore remains in the native firmware.
This approach is particularly useful for bring-up, testing and low-level diagnostics.
Use it for: Direct access to individual LIN operations.
Layer 3 โ Runtime, queries and application workers
For more complex applications, logic can run directly on the microcontroller.
Host
โ
TX query
โ
Application or native worker
โ
RX query
โ
Host
A query transports data between the host and a worker. The worker determines what those data mean.
The standard workers expose individual LIN operations such as SEND and REQUEST. A custom worker can implement a higher application layer, for example:
- Simulate a complete sensor or actuator.
- Combine several LIN frames into a single function.
- Maintain state.
- React to bus events.
- Execute test sequences autonomously.
- Report only results or events to Linux.
Consequently, a host application does not necessarily have to trigger every LIN command individually.
Use it for: Stateful protocols, simulation, testing logic and custom application functions.
Layer 4 โ C or Python application on Linux
Regular applications access beiis-lind through a Unix socket.
C / Python / other application
|
v
beiis-lind
|
v
Runtime
The application does not need to manage IยฒC or GPIO itself.
The microcontroller signals pending data through an isolated interrupt line connected to Raspberry Pi GPIO6. beiis-lind uses the interrupt as a wake-up signal and then reads data over IยฒC.
C or Python applications can wait for data without implementing their own GPIO or IยฒC polling.
Use it for: General applications, test software, gateways and automation.
Repository layout
The repository is organized according to these layers.
be-iis-lin/
โโโ host/
โ โโโ beiis_lin/
โ โ โโโ daemon.py
โ โ โโโ client.py
โ โ โโโ socket_protocol.py
โ โ โโโ i2c_transport.py
โ โ โโโ gpio_irq.py
โ โโโ tests/
โ
โโโ stm32/
โ โโโ boards/BEIIS_LIN_HAT/
โ โ โโโ board_init.c
โ โ โโโ frozen/
โ โ โโโ beiis_runtime.py
โ โ
โ โโโ lib/
โ โ โโโ lin/
โ โ โโโ app_i2c/
โ โ
โ โโโ micropython/
โ โโโ modules/
โ โ โโโ lin/
โ โ โโโ appio/
โ โ
โ โโโ apps/
โ โโโ query.py
โ โโโ lin_native.py
โ โโโ logging_native.py
โ
โโโ protocol/
โโโ examples/
โ โโโ runtime/
โ โโโ ip-over-lin/
โ
โโโ scripts/
โโโ docs/human/
Linux application and socket
host/beiis_lin/ contains the Linux-side software.
client.py Python client for applications
daemon.py beiis-lind daemon
socket_protocol.py JSON protocol over SOCK_SEQPACKET
i2c_transport.py Linux-to-microcontroller transport
gpio_irq.py Raspberry Pi GPIO6 interrupt
This is the main entry point for integrating a Python or C application.
Runtime on the microcontroller
The runtime implementation is located at:
stm32/boards/BEIIS_LIN_HAT/frozen/beiis_runtime.py
It starts instances, routes messages and manages active runtime paths.
Reusable applications live in:
stm32/micropython/apps/
Key files:
query.py Generic TX/RX queries
lin_native.py Runtime worker for LIN
logging_native.py Logging worker
Direct MicroPython access
The import lin Python interface is provided by the native MicroPython module:
stm32/micropython/modules/lin/
This module connects MicroPython to the native C LIN core.
Native C LIN layer
The actual LIN implementation is in:
stm32/lib/lin/
This contains time-critical master, slave, checksum and LIN frame functions.
Board-specific UART, GPIO, LED, IยฒC and host interrupt integration is in:
stm32/boards/BEIIS_LIN_HAT/board_init.c
Examples
Executable examples live in:
examples/runtime/
Including:
python_basic.py
c_basic.c
custom_query_worker.py
install_custom_query.py
custom_query_client.py
The separate directory:
examples/ip-over-lin/
contains the experimental IP-over-LIN implementation. It is not part of the normal LIN application layer.
Installation and protocol documentation
Install the standard runtime with:
scripts/install-standard-runtime.py
The internal runtime protocol is documented at:
protocol/APP-RUNTIME.md
Further developer documentation is available in:
docs/human/
Which layer should you use?
Test individual LIN frames or bring up hardware
โ Direct MicroPython access or the ready-to-run examples in Send & Receive.
Develop a regular C or Python application
โ The beiis-lind socket interface; see Python & C.
Run higher-level application logic on the microcontroller
โ Runtime with queries and custom workers; see Runtime & Queries.
Add new time-critical bus functionality
โ The native C LIN module in the firmware.
Further documentation
- Send & Receive โ Master TX, Master RX, Slave TX, Slave RX and baud rate
- Python & C โ Integrating your own Linux applications
- Runtime & Queries โ Runtime architecture and internal data paths
- Custom Queries & Logging โ Custom workers, taps and advanced applications
- Firmware & Flashing โ Building, updating and recovering firmware
Availability: Coming soon.