radino32 software
This page is out of date
visit radino/radino32 software
Contents |
This page describes how to use the radino32 module.
Descriptions are limited mostly to differences to the radino modules. For the rest see radino WiFi software.
Overview
The radino Library since version 4 includes all files required to compile and upload sketches using the Arduino 1.6.0 / 1.6.1.
Extract this library into your %ARDUINO_APPDATA% folder as described at Install radino library.
Afterwards the radino32 is selectable within the Arduino IDE under "Tools->Board" as "radino32 USB-Load".
Howto
Compiling sketches
As the Arduino team removed the gcc compiler for ARM based devices from Arduino IDE 1.6.2 and following. The sketches for the radino32 can only be compiled with versions 1.6.0 or 1.6.1 of the Arduino IDE.
- Select "radino32 USB-Load" under "Tools->Board". (All radino32 can be programmed using this option)
- Hit the Verify button.
Uploading sketches
- Start the bootloader on the radino32 as described here: Starting the bootloader
- If necessary, install the bootloader drivers as described here: Installing bootloader drivers
- Start uploading within the Arduino IDE.
- After the upload finished. Reset the radino32 and it will execute the uploaded sketch.
Starting the bootloader
Method 1:
- Pull pin "BOOT_SEL" high (You can achieve this by shortening the pin with "VCC" directly besides it).
- Apply a high pulse to pin "RESET".
- Release pin "BOOT_SEL".
Method 2:
- Disable supply voltage to the module.
- Pull pin "BOOT_SEL" high (You can achieve this by shortening the pin with "VCC" derectly besides it).
- Apply supply voltage.
- Release pin "BOOT_SEL".
Method 3:
- this method works on modules that contain a BSL-button (e.g. radino Leonardo, radino Spider RP-SMA, radino USB Stick, radino RS485/RS232-Bridge IP65, radino DinRail Adapter)
- Apply supply voltage.
- press & hold BSL- and RESET-Button
- release RESET-button
- release BSL-button
- (repeat these steps if your radino doesn't enter bootloader mode right away.)
Installing bootloader drivers
- After entering the Bootloader windows will detect the new device.
- Use the zadig driver installation tool under "%ARDUINO_APPDATA_FOLDER%/hardware/ICT_Boards/stm32l1/driver/win" to install drivers for the STM32 Bootloader.
- Make sure within the installation tool "libusbK (v3.0.7.0)" is selected.
On Windows 7 or newer it is necessary to prevent installation of other stm32 drivers. radino32 driver installation on Windows 7 explains how to do so.
Bootloader is not recognized
Please look at radino32 USB connection fails
Usage
UART
The radino32 module has two external hardware UARTS, named Serial1 and Serial2. Both support baud rates up to 115200.
USB serial
The USB serial is started by using
serial.begin();
within your setup routine. Afterwards it is used simliar to the UARTs. If problems arise please have a look at radino32 USB connection fails
Getting USB serial drivers
- st offers drivers for the stm32s virtual com port on their website http://www.st.com. Find them by searching for virtual com port driver
- Direct link to the drivers page: http://www.st.com/web/en/catalog/tools/PF257938
GPIOs
The radino32 module has 23 multifunctional GPIOs (14 PWM, 10 ADC IN, 1 DAC OUT). See the table below for which pins belong to which group.
group | pins |
---|---|
PWM (out) | A0, A3, 2, 3, 5, 6, 10, 11, 12, 13, 14, 15, 16, 18 |
DAC (out) | A2 |
digital | A0, A1, A2, A3, A5, 0, 1, 2, 3, 5, 6, 10, 11, 12, 13, 14, 15, 16, 17, 18, 25, 26, 27 |
ADC (in) | A0, A1, A2, A3, A5, 6, 10, 11, 12, 13 |
Writing
In order to write to a GPIO you have to set the pinMode first. Digital pins can use mode OUTPUT or OUTPUT_OPEN_DRAIN. For analog pins you have to set mode to PWM.
pinMode(digitalPin, OUTPUT); pinMode(analogPin, PWM);
To write a GPIO you can use digitalWrite (values: LOW, HIGH) and analogWrite (values: 0 - 1023) respectively.
digitalWrite(digitalPin, HIGH); analogWrite(analogPin, 1023);
To set the GPIO in one cycle you have to use constants as pin numbers. This way you can toggle the GPIO with full clock speed.
digitalWrite(5, HIGH);
mode | PWM pins pinMode(PWM) |
DAC pin pinMode(PWM) |
output pinMode(OUTPUT) pinMode(OUTPUT_OPEN_DRAIN) |
---|---|---|---|
analog | yes (pwm signal) |
yes (voltage level) |
- |
digital | - | - | yes |
Reading
Similar to writing you have to setup the GPIO pins first. You can set pinMode to INPUT or INPUT_PULLUP. INPUT_FLOATING is a synonym for INPUT. For Analog pins use INPUT_ANALOG
pinMode(digitalPin, INTPUT_PULLUP); pinMode(analogPin, INTPUT_ANALOG);
To read a GPIO you can use digitalRead and analogRead respectively.
int digitalValue = digitalRead(digitalPin); int analogValue = analogRead(analogPin);
It will not work if you try to read a digital pin with analogRead or vice-versa.
WiFi
Sketches using WiFi (IC_ESP library) only need modified include headers:
#include <radino32_UART.h> #include <IC_ESP.h>
The rest works similar to the sketches for the radino modules.