0

I am having trouble making an Arduino Pro Mini send commands via USART to an STM32 chip. The serial communication protocol is currently set to 9600 baud rate with no flow control or stop bits. Is there anything special that has to be done to make these two devices communicate with each other? I'm using the standard RX/TX pins for this. The Arduino logic level is 3.3V. The STM32 logic level is 2.5V. They share a common ground. I should also note that there is a 1K ohm resistor in series with each data line. Here's the code that I'm trying to use:

#include <Arduino.h> 

void setup() 
{
  Serial.begin(9600); 
  delay(4000);
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() 
{
  digitalWrite(LED_BUILTIN, HIGH);   
  delay(1000);                      
  digitalWrite(LED_BUILTIN, LOW);    
  delay(1000);                       
  digitalWrite(LED_BUILTIN, HIGH);   
  delay(1000);                       
  digitalWrite(LED_BUILTIN, LOW);    
  delay(1000);
  String voltage = String("85 2 0 0 10 174 96"); //Command to set voltage output on STM32
  Serial.println(voltage);

  while (1) {  
    digitalWrite(LED_BUILTIN, HIGH);   
    delay(200);                       
    digitalWrite(LED_BUILTIN, LOW);    
    delay(200);
  }   
}
  • Nothing special needs to be done. Beyond that, we can't really help you without seeing some code. – TisteAndii Jun 18 at 4:23
  • Do the chips share a common ground? Do they use the same logic voltage levels? Are they both powered? Did you connect the Arduino's TX to the STM32's RX? Do you have a scope? – Edgar Bonet Jun 18 at 7:19
  • Please see the edited post. They are both definitely powered and the RX/TX lines are wired correctly. – RadiationGuy80 Jun 18 at 14:56
  • I see nothing wrong on the Arduino side. Are you sure the STM32 expects text rather than binary? Does it like the CRLF line termination? Is its RX 3.3V-tolerant? – Edgar Bonet Jun 18 at 19:18
  • According to the datasheet, the STM32 is 3.3V tolerant. I haven't tried binary. I will give that a go. Thank you for the quick response! – RadiationGuy80 Jun 19 at 1:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.