How does it work?
RS232 SPI click two ICs - MAX3100 and MAX3232. MAX3100 serves as UART interface to the SPI/MICROWIRE compatible interface converter. In the same time, MAX3232 device enables RS232 SPI click to meet the requirements of TIA/EIA-232-F and also provides the electrical interface between an asynchronous communication controller and the serial-port connector. The charge pump and four small external capacitors allow operation from a single 3-V to 5.5-V supply.
RS232 SPI click Uses an SPI™/MICROWIRE™ interface for communication with the host microcontroller (µC). Then, the MAX3100 is responsible for conversion from synchronous serial data from a microcontroller to asynchronous, serial-data communication port such as RS-232, RS-485, IrDA. In this case the RS232 protocol is used. The MAX3100 includes a crystal oscillator and a baud rate generator with software-programmable divider ratios for all common baud rates from 300 baud to 230k baud. The transmitter section accepts SPI/MICROWIRE data, formats it, and transmits it in asynchronous serial format from the TX output. Data is loaded into the transmit buffer register from the SPI/MICROWIRE interface. The MAX3100 adds start and stop bits to the data and clocks the data out at the selected baud rate.
A software- or hardware-invoked shutdown lowers quiescent current to 10µA, while allowing the MAX3100 to detect receiver activity. An 8-word-deep first-in/first-out (FIFO) buffer minimizes processor overhead. This device also includes a flexible interrupt with four maskable sources, including address recognition on 9-bit networks. Two hardware-handshaking control lines are included (one input and one output).
Because of the features contained in its modules, the RS232 SPI click can be used for handheld instruments, UART in SPI systems, small networks in HVAC or Building control, battery-powered systems, PDAs, notebooks and many more.
RS232 SPI click offers a selection between 3.3V and 5V operation, with the onboard SMD jumper, labeled as VCC SEL. This allows both 3.3V and 5V MCUs to be interfaced with this Click board™.
Specifications
Type |
RS232 |
Applications |
Handheld instruments, UART in SPI systems, small networks in HVAC or Building control, battery-powered systems, PDAs, notebooks and many more |
On-board modules |
MAX3100 MAX3100 serves as UART interface to the SPI/MICROWIRE compatible interface converter from Maxim Integrated; MAX3232, a 3-V to 5.5-V Multichannel RS-232 Line Driver/Receiver from Texas Instruments |
Key Features |
Operates up to 250 kbit/s, Operates With 3-V to 5.5-V VCC Supply, RS-232 Bus-Terminal ESD Protection Exceeds ±15 kV Using Human-Body Model (HBM) |
Interface |
SPI |
Click board size |
L (57.15 x 25.4 mm) |
Input Voltage |
3.3V or 5V |
Pinout diagram
This table shows how the pinout on RS232 SPI click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Notes |
Pin |
|
Pin |
Notes |
---|
|
NC |
1 |
AN |
PWM |
16 |
NC |
|
Device shut down |
SDN |
2 |
RST |
INT |
15 |
INQ |
Interrupt Output |
SPI Chip Select |
CS |
3 |
CS |
RX |
14 |
NC |
|
SPI Clock |
SCK |
4 |
SCK |
TX |
13 |
NC |
|
SPI Data OUT |
SDO |
5 |
MISO |
SCL |
12 |
NC |
|
SPI Data IN |
SDI |
6 |
MOSI |
SDA |
11 |
NC |
|
Power Supply |
3.3V |
7 |
3.3V |
5V |
10 |
5V |
Power supply |
Ground |
GND |
8 |
GND |
GND |
9 |
GND |
Ground |
Onboard settings and indicators
Label |
Name |
Default |
Description |
---|
LD1 |
PWR LED |
- |
Power LED Indicator |
JP1 |
VCC SEL |
Left |
Power supply voltage selection: left position 3.3V, right position 5V |
Software Support
We provide a library for the RS232 SPI Click on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
The library covers all the necessary functions that enables the usage of the RS232 SPI click board. User can send or receive data, check if data is ready or if tx line is busy, it is possible to change baud rate and to turn the device on or off.
Key functions:
uint8_t rs232spi_dataRead()
- Function is used to read data from the receive register.
uint16_t rs232spi_dataReady()
- Function is used to check if there is availavle data for reading.
void rs232spi_dataWrite( uint8_t wrData )
- Function is used to write into the transmit-buffer register.
Examples description
The application is composed of three sections :
- System Initialization - Initializes SPI and LOG structures, sets RST pin as output and INT pin as input.
- Application Initialization - Initialization driver enables SPI, sets up the device and starts write log.
- Application Task - (code snippet) This example demonstrates the use of RS232 SPI click board by sending or receveing the message.
void applicationTask()
{
uint8_t tmp;
char rec;
uint8_t mode = RS232SPI_WRITE_MODE;
if ( mode == RS232SPI_READ_MODE )
{
// RECEIVER - UART polling
if ( rs232spi_dataReady() != 0 )
{
rec = rs232spi_transfer( _RS232SPI_CMD_READ_DATA );
mikrobus_logWrite( &rec, _LOG_BYTE );
}
}
else if ( mode == RS232SPI_WRITE_MODE )
{
// TRANSMITER - TX each 2 sec
for ( tmp = 0; tmp < 9; tmp++ )
{
rs232spi_dataWrite( MESSAGE_DATA[ tmp ] );
if ( tmp < 6 )
{
Delay_ms( 100 );
}
}
Delay_ms( 2000 );
}
}
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
mikroSDK
This Click board™ is supported with mikroSDK - MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.
Resources
Downloads