0
\$\begingroup\$

I have five UART-based sensors from the same type which are continuously transmitting package at baud rate of 9600 kbps and every one second continuously (they have only TX and RX and power pins each).

I want to read the sensor reading for all of them by one UART of microcontroller (STM32).

After reading them, I want to display their values on a graphic application by Qt application (of course through virtual port com).

I thought of an analog dual channel multiplexer, but I think there would be a problem because they send data simultaneously and every second, so the data from one or more sensors will got lost.

Another solution I thought, was to use a microcontroller (STM32) with eight UARTs and reading the sensor data with interrupt, but I think it would be a collision and perhaps two sensors will interrupt two UARTs of STM32 at the same time.

The sensor has 2 modes:

  • Default mode is transmitting data over UART every 1 second at BR 9600.
  • The second mode is ask/answer mode (BR = 9600).

For ask/answer mode, the response time of the sensor is not determined, but it is less than 15 seconds (randomly). Therefore I will use the default mode.

Any suggestion how to solve this problem will be great.

JYelton
35.7k34 gold badges149 silver badges281 bronze badges
asked Jul 15 at 20:20
\$\endgroup\$
1
  • \$\begingroup\$ As you said Qt, is there any computer with USB involved? If yes, use five USB-RS232 converters for this. They are incredibly cheap and you get ready to market in much shorter time. \$\endgroup\$ Commented Jul 15 at 20:47

1 Answer 1

2
\$\begingroup\$

In general there is no issue. You don't say which STM32 you would use, but many of them have the required amount of UARTs and many of them can use DMA or have FIFOs for buffering, but for something simple as receiving 5 sensors at 9600 bps, you can even poll the data as there will never be more than 5 bytes per millisecond even if all are transmitting a continuous burst simultaneously.

Even if five bytes are received simultaneously with interrupts, so what, an MCU running at tens of MHz is capable of handling 5 interrupts every millisecond.

JYelton
35.7k34 gold badges149 silver badges281 bronze badges
answered Jul 15 at 20:41
\$\endgroup\$
2
  • \$\begingroup\$ Thank you for your reply, The communication package for send/receive will be 9 bytes(including the checksum). The sensors's UART Output (TTL electrical level,3V) and are powered by 5V. If i use multiplexer,should i use pull up resistors at the slaves sides and microcontroller side?any HW consideration should i think of to avoid collision or noise when slaves's transmit line is open-circuit as soon as we switch from one sensor to another. Thank you \$\endgroup\$ Commented Jul 16 at 4:36
  • \$\begingroup\$ @EmadKhadeja Microcontrollers have internal pull ups. You can use internal or external pullups on inputs. \$\endgroup\$ Commented Jul 16 at 8:50

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.