====== Device Drivers ======
Currently we support the mpc555 and mpc5200 PowerPC processors as well as the Zynq7000 ARM processor. They differ in their core features as well as in their built-in peripherals. Both are rich in built-in peripheral modules. In order to facilitate the use of those modules the runtime system offers a lot of software drivers. In the following sections there are short descriptions of drivers available. Details about a specific driver and its use can be found [[http://api.deepjava.org/runtime-library/|API of the Runtime Library]].
===== Zynq7000 =====
There are many device drivers for the internal hardware of the Zynq7000 processor and external hardware connected to it. When designing external electronics for the Zynq7000 processor and notably for the [[https://wiki.bu.ost.ch/infoportal/embedded_systems/zynq7000/microzed|Microzed]] board, please refer to [[https://wiki.bu.ost.ch/infoportal/embedded_systems/zynq7000/carrier|Carrier Card Design]] for help.
==== flink Devices ====
The Zynq7000 incorporates a configurable programmable logic (PL) block, which is an FPGA. We support the configuration of the PL with [[https://flink-project.ch/]]. flink offers useful blocks for
* GPIO (general purpose input / output)
* PWM generation (pulse width modulation)
* Counter (e.g. for fast quadrature decoding for encoder signals)
* PPWA measurement (period and pulse width measurement)
* DAC (digital to analog converter)
* ADC (analog to digital converter)
* UART
* Watchdog
See [[https://api.deepjava.org/runtime-library/org/deepjava/flink/subdevices/package-summary.html]] for further details of using these components. The FPGA itself is a // flink device// while the blocks within are denoted as //flink subdevices//.
flink is very powerful in that a specific configuration can be prepared with a set of subdevices while each subdevice can have a configurable number of channels. These channels can be mapped on any of the available MIO-pins of the Zynq7000. This offers unique flexibility.
==== Universal Asynchronous Receiver/Transmitter (UART, RS232) ====
The Zynq7000 offers two independent UART interfaces. The UART0 is available on MIO14 (RX) and MIO15 (TX) with TTL levels. UART1 is routed to an FTDI-Chip and available on the USB connector on J2.
// 1) Initialize UART1 (115200 Baudrate, 8N1)
UART uart = UART.getInstance(UART.pUART1);
uart.start(115200, (short)0, (short)8);
// 2) Use UART1 for stdout
System.out = new PrintStream(uart.out);
// 3) Redirect stderr to stdout (optional)
System.err = System.out;
We offer a dedicated driver ''RN131'' for WLAN Roving RN-131C WiFly module which directly connects to one of the UART. \\
More UARTs are available as flink devices, see above.
==== XADC ====
The Zynq7000 processor incorporates an ADC (XADC). When measuring unipolar analog input signals, the differential analog inputs (VP and VN) have an input range of 0V to 1.0V. The voltage on VP (measured with respect to VN) must always be positive. VN is typically connected to a local ground. Because the differential input range is from 0V to 1.0V (VP to VN), the maximum signal on VP is 1.0V.
==== Support for In-House Hardware ====
Several dedicated drivers exist for in-house hardware like our control board (''RTBoard'').
===== mpc555 =====
==== Digital I/O’s ====
The mpc555 offers several general purpose I/O-ports. Most of the pins including TPU pins, analog input pins and the pins for the serial communication interface can be config-ured for I/O operation if not used for their specific purpose. However, there are 16 pins in the MIOS-Module which serve solely for digital I/O. These 16 pins are controlled in the sub module MPIOSM.
They are designated MPIOBx on the expansion connector.
Each of the pins can be easily programmed for input or output operation (see class ''Mpiosm_DIO''). If more than 16 pins are needed, a TPU pin can work as a digital I/O pin (see ''TPU_DIO''). This gives another 32 I/O pins. Another possibility for more digital I/O are the pins of the ADC. Instead of using these ports with 32 pins in total as analogue inputs you can configure them for digital operation (see ''ADC_DIO'').
Pins for PWM generation also offer digital I/O's (''MPWMSM_DIO'') as well as pins for serial communication (''QSMCM_DIO'').
==== Multiple Input/Output System ====
This peripheral interface offers among many other things 8 pulse with modulated outputs (''MPWMSM_PWM'').
==== Serial Communication Interface (SCI, RS232) ====
The mpc555 offers two independent SCI interfaces. The necessary bus converters for RS232 voltage level are already incorporated on the microcontroller board. An easy to use interface is offered by ''SCI1'' for the first and ''SCI2'' for the second serial communication interface. An Input or OutputStream can be connected to any of those channels. The System.out stream can be put on this connections as follows.
// 1) Initialize SCI2 (9600 Bd, 8N1)
SCI sci2 = SCI.getInstance(SCI.pSCI2);
sci2.start(9600, SCI.NO_PARITY, (short)8);
// 2) Use SCI2 for stdout
System.out = new PrintStream(sci2.out);
// 3) Redirect stderr to stdout (optional)
System.err = System.out;
We offer a dedicated driver ''BlueRS'' for the Stollmann BlueRS+I Bluetooth module which directly connects to one of the SCI. For WLAN there is a driver ''RN131WiFly'' which uses a Roving RN-131C WiFly module.
==== Serial Peripheral Interface (SPI) ====
Up to 4 external units can be directly connected to the SPI. With further decoding this can be extended to 16 units.
As the SPI makes use of a synchronous serial bus with shared signals for transferring data, it is not possible to combine two or more of these drivers without adaptation of the chip-select signals, serial clock rate and serial clock edge control. Please refer to the user manual of the mpc555.
You can find ''TLC549''. It uses an external low-cost 8-bit ADC on the SPI bus. For analogue output there is a driver for a 12 bit, 4 channels DAC (''DAC7614'') or you can use ''MAX512''.
==== Time Processor Unit (TPU) ====
The mpc555 has two independent TPUs, called TPUA and TPUB. Each of them presents 16 individual channels. A multitude of timing functions can be produced without any processor interaction. Software drivers for the following functions exist:
* ''TPU_PWM'': PWM generation
* ''TPU_PPWA'': Pulse and period measurement
* ''StepMotor'': For step motor control. Various modes can be selected. 2 or 4 pins are used depending on half or full step mode
* ''TPU_FQD'': Fast quadrature decode function for digital encoders (uses 2 channels)
==== Analog-Digital Converters (ADC) ====
The mpc555 has two independent 10-bit ADCs with 16 input channels each. ''QADC_AIN'' offers an easy to use interface for these two devices. Please make sure to connect the analog ground to digital ground. This can be done on a custom board onto which the mpc555 microcontrollerboard is mounted. If you use our base platform for easy experimenting you must connect the Pin AGnd with ground.
Especially for our various roboter projects we developed a driver ''HLC1395Pulsed'' for up to 16 low-cost close range distance sensors. They work up to several centimetres but need additional dedicated hardware.
==== Bus Interface Unit ====
The mpc555 has a universal bus interface unit to connect any memory or external component with a parallel bus interface to the system bus. A chip-select mechanism eliminates the need for external glue logic.
You can find a driver for the popular character-LCD controller HD44780U which uses the system bus (''HD44780U'').
==== CAN Bus ====
The mpc555 offers to indepedent CAN controllers. On the headerboard the necessary physical driver is already included (but no 120Ω termination resistor). An basic driver for CAN and CANopen exists. Please ask for assistance.
==== Support for In-House Hardware ====
Several dedicated drivers exist for in-house hardware like our control board (''RTBoard'') or our two-wheel robot (''Robi2'').
==== Flash File System ====
Part of the external flash on the microcontroller board can be used for storing user data. This could be data files such as log files for permanent storage or font files for display purposes. Therefore a flash file system offers a simple interface for creating, registering and deleting files. Please ask for assistance.
===== mpc5200 =====
Please check the [[http://api.deepjava.org/runtime-library/|API of the Runtime Library]] for available drivers.