RS232 Click Example output ??

General discussion on Libstock website & codes posted on this website.
Post Reply
Author
Message
cheaberlin@outlook.com
Posts: 7
Joined: 18 Jul 2023 22:36

RS232 Click Example output ??

#1 Post by cheaberlin@outlook.com » 19 Aug 2023 21:11

I am attempting to use the RS232 Click Example program with my Fusion v8 pic32 development board and read ascii text data from an external device. I connected the device thru a nullo modem device to the DB9 connector on the click. I receive data however I receiving non standard ascii characters (ext-ascii). Initially i thought possibly my device was sending UTF encoded data, so i wrote a smal C program on my laptop and read the serial data which should the data I expected (see below.) I then modified the example so that the buffer used was type uint8_t versus unsigned char and passed the address of the first character of that buffer. This returned at least single bytes, but still not bytes I expected, bytes starting with STX ending with ETX. What does the RS232 click device output assumed serial data that was input??

sample expected bytes:
0x2 0x2a 0x4e 0x54 0x46 0x2c 0x55 0x49 0x2c 0x50 0x54 0x54 0x2c 0x4f 0x4e 0x3

received bytes: NOT to be interpreted as a above.. not sure what this is....just an example of output
0x24 0x0 0x42 0xfb 0x24 0x80 0x80 0xc4 0xbb 0xc4 0xdb 0xc4 0xbb 0xbb 0xc4 0xf7

User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: RS232 Click Example output ??

#2 Post by IvanJeremic » 31 Aug 2023 08:50

Hi,

Can you send me a photo of how you connected everything?

This click board was meant to work with another RS232 click so they can communicate with each other.

Regards,

Ivan.

cheaberlin@outlook.com
Posts: 7
Joined: 18 Jul 2023 22:36

Re: RS232 Click Example output ??

#3 Post by cheaberlin@outlook.com » 01 Sep 2023 00:22

Ivan,

Attached is a picture of my setup, it is the Fusion v8 pic32 version with the RS232 Click in the first Mikrobus slot, it is connected to a NULL modem device which is then connected to the device I am trying to receive serial data from (RS232 format.) I would think it shouldn't matter if it is "talking" to another RS232 Click or another device that is communicating RS232 data...

Catherine
Attachments
20230831_171330.jpg
20230831_171330.jpg (1.59 MiB) Viewed 844 times

cheaberlin@outlook.com
Posts: 7
Joined: 18 Jul 2023 22:36

Re: RS232 Click Example output ??

#4 Post by cheaberlin@outlook.com » 01 Sep 2023 00:29

Ivan,

Also both devices are set to 9600 baud, 8N1 which is the default of the click example code as well as the device I am trying to receive data from...

User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: RS232 Click Example output ??

#5 Post by IvanJeremic » 06 Sep 2023 13:35

Hi,

I had experience where if use two similar clicks to RS232, one is placed on one type of MCU and the other on some other MCU and even though their baudrates are set correctly, because of different clocks it does not work sometimes (although i think this would happen with an MCU such as PIC16, PIC18 or AVR).

That might be the issue here, can't be certain since i can't reproduce your issue.

Also here is the example code with its source files, it might be of help to you.
https://github.com/MikroElektronika/mik ... icks/rs232

The baudrate in this example is 115200.

Regards,

Ivan.

cheaberlin@outlook.com
Posts: 7
Joined: 18 Jul 2023 22:36

Re: RS232 Click Example output ??

#6 Post by cheaberlin@outlook.com » 06 Sep 2023 21:14

Ivan,

This is exactly the code I have been using... I modified the rs232 cfg initialization to 9600 vs 15200 baud.

"The most common type of hardware implementation for asynchronous serial communication is known as RS-232." "Asynchronous serial communication is a communication interface in which the signals used are NOT synchronized to each other using a common clock signal.. instead, start and stop bits are used to indicate the beginning and end of a data message." "They must agree upon the rate at which bits will be transmitted and received (baud rate) since there is NO clock signal..."

Based on this information I am not sure how the individual devices must have similar clock speeds... please explain..

AntiMember
Posts: 135
Joined: 02 Jan 2020 19:00

Re: RS232 Click Example output ??

#7 Post by AntiMember » 12 Sep 2023 17:01

In the example from the link above, the default parameters are: 9600 8N1.

Code: Select all

drv_uart.h
UART_DATA_BITS_DEFAULT = UART_DATA_BITS_8
UART_PARITY_DEFAULT = UART_PARITY_NONE
UART_STOP_BITS_DEFAULT = UART_STOP_BITS_ONE
...............................................................
rs232.c
void rs232_cfg_setup ( rs232_cfg_t *cfg )
{
.........................................................

    cfg->baud_rate      = 9600;
    cfg->data_bit       = UART_DATA_BITS_DEFAULT;
    cfg->parity_bit     = UART_PARITY_DEFAULT;
    cfg->stop_bit       = UART_STOP_BITS_DEFAULT;
    cfg->uart_blocking  = false;
}
Asynchronous only denotes the absence of a clock signal.
The speed and parameters must be the same on end devices.
TX-RX, RX-TX and the ground contacts must be connected.

Post Reply

Return to “Libstock Discussion”