cancel
Showing results for 
Search instead for 
Did you mean: 

Wiring UART communication between Arduino Nano SoftSerial and STM32F103C8T6

ERadu.1
Associate

Hello!

I have an STM32F103C8T6 (BluePill) as master device. It need to collect some data from and Arduino Nano over UART, so the communication is monodirectional Nano -> STM32 -> PC

At a Nano, i can define any two digital ports to be softserial (D2, D3) . On the STM32 side, i use now the Serial2 (A2, A3) with an CP2104 USB TTL on 5V to communicate between STM32 and a PC, but can i use in same time also the Serial1 (B6, B7) to communicate between STM32 and the Arduino Nano?

Is enough that i crosswire the B6 and B7 at STM32 side with D3 and D2 Arduino nano Side (Tx->Rx, Rx->Tx) or i need to connect also GND and 5V?

I think the Nano will works with this digital pins at 5V, is this a problem on STM32 side?

3 REPLIES 3

> can i use in same time also the Serial1 (B6, B7) to communicate between STM32 and the Arduino Nano?

Yes, if you don't use blocking functions for them. Use interrupts.

> Is enough that i crosswire the B6 and B7 at STM32 side with D3 and D2 Arduino nano Side (Tx->Rx, Rx->Tx) or i need to connect also GND and 5V?

GND - definitively, 5V - no need.

> I think the Nano will works with this digital pins at 5V, is this a problem on STM32 side?

Maybe.

If the STM32 pins are not 5V tolerant, you may damage them. Check in the datasheet, pin table, for the particular pins you've chosen. (This is assuming you have a genuine STM32, not any of the non-ST clones).

Even for 5V- tolerant pins, communication may be not be perfectly reliable, check the input and output levels in both AVR and STM32 datasheets' electrical characteristics.

JW

ERadu.1
Associate

@Community member​ 

Thank You for Your advice!

> Yes, if you don't use blocking functions for them. Use interrupts.

Can You give me an example? I think have now this issue You mentineod, here is my code:

#include "stm32f103c8t6.h"
#include "mbed.h"
#include "USBSerial.h"
#include "Crypto.h"
 
 
 
DigitalOut  myled(LED1);
Serial pc(PA_2, PA_3);
Serial nano(PA_9, PA_10);
 
int main() {
 
while(1) 
    {
     //Read from Nano
        if(nano.readable()) 
        {
            pc.printf("Nano is here!\n");
        }
        else
        {
            pc.printf("Nano is unreadable\n");
        }
        wait_ms(1000);
    }
}

I receive alway that is nano not readable, and i don't known why?

I don't use Arduino, and there's probably nobody here who does.

You may perhaps want to discuss this at stm32duino.com .

JW