<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[STM32F411 BlackpillV2 ST core - problem with reading data from RS485 (HW serial 2)]]></title><description><![CDATA[<p dir="auto">Hi,<br />
for years Im using MySensors 2.3.1 lib running on Bluepill (STM32F103C8T6 <strong>Roger`s STM32 core)</strong> with RS485 transport as a node without any problems. Now I need to add new node so I decided  to use BlackPill 2 (STM32F411) with <strong>STM32 ST core</strong> and <strong>Whisky Delta fork</strong> . (<a href="https://github.com/WhiskyDelta/MySensors/tree/stm32_cores" rel="nofollow ugc">https://github.com/WhiskyDelta/MySensors/tree/stm32_cores</a>) I have <strong>no problem with code compilation</strong> of simple test node sketch but <strong>node is not receiving data from gateway through RS485</strong>.</p>
<p dir="auto">As you can see from debug log, node send a message and GW replied but node does not received anything. Strange thing is that some chars appeared in debug console "�vXvv���" before 2215 ?TSF:MSG:SEND,.....</p>
<p dir="auto">For testing purpose Iv got on desk Ardu Nano as GW with MAX485 converters and as a node I tested with Whisky Delta lib one by one Arduino Mega2560 , Bluepill STM32F103c8t6 , Blackpill2 STM32F411 and F4VE (STM32F407VET). As a node is working only Mega2560. Bluepill were frozen after first attempt to pair with GW. Blackpill 2 and F4VE are repeating sending request for pair to GW with this strange chars in serial debug. ("�vXvv���")</p>
<p dir="auto">Im sure that HW  is ok. (wiring,DE+RE,termination resistors,5V supply of MAX485, etc)</p>
<p dir="auto">Does anybody else has a problem like this ? Do you have any idea where should be a problem ?</p>
<p dir="auto">Gateway received data from node and responded</p>
<pre><code>0;255;3;0;9;8233171 TSF:MSG:READ,118-118-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
0;255;3;0;9;8233177 TSF:MSG:BC
0;255;3;0;9;8233180 TSF:MSG:FPAR REQ,ID=118
0;255;3;0;9;8233184 TSF:PNG:SEND,TO=0
0;255;3;0;9;8233187 TSF:CKU:OK
0;255;3;0;9;8233190 TSF:MSG:GWL OK
0;255;3;0;9;8233447 TSF:MSG:SEND,0-0-118-118,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
</code></pre>
<p dir="auto">Node trying to pair but does not receive data from gateway. What are chars �vXvv��� ?</p>
<pre><code>2050 MCO:BGN:INIT OK,TSP=0
2211 !TSM:FPAR:NO REPLY
2213 TSM:FPAR
�vXvv���2215 ?TSF:MSG:SEND,118-118-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0

</code></pre>
<p dir="auto">Simple node sketch. Debug is using Serial1 and MAX485 is using Serial2</p>
<pre><code>#define MY_DEBUG                          

#define MY_TRANSPORT_WAIT_READY_MS 2000  

//#define MY_TRANSPORT_SANITY_CHECK
//#define MY_TRANSPORT_SANITY_CHECK_INTERVAL 2000 
//#define MY_RS485_SOH_COUNT 2

#define MY_NODE_ID 118

#define MY_RS485
#define MY_RS485_DE_PIN PB3

#define MY_RS485_HWSERIAL Serial2

#define MY_RS485_BAUD_RATE 9600


#include &lt;MySensors.h&gt;

#define CHILD_ID_SudyNode 0

MyMessage msgStatus(CHILD_ID_SudyNode, V_VAR1); //Status
MyMessage msgErrorEvent(CHILD_ID_SudyNode, V_VAR2); //Err event
MyMessage msgDebug(CHILD_ID_SudyNode, V_VAR3); //DEBUG


void presentation() {  sendSketchInfo("TestNODE", "Ver. 1");present(CHILD_ID_SudyNode, S_CUSTOM);}


void setup() {

     Serial.setRx(PA10);
     Serial.setTx(PA9);
     Serial.begin(115200);  

}

String SendBuffer = "TEST Message";
unsigned long CasovacMillis = millis();

void loop() {


if ((millis() - CasovacMillis) &gt;= 3000) { 
 Serial.println("NODE ALIVE");
 send(msgStatus.set(SendBuffer.c_str()));
 CasovacMillis = millis();
}

}
void receive(const MyMessage &amp;message) {
                        
  if (message.sensor == 123 ) {
      String BufferString = message.getString();
      char CommandBuffer[BufferString.length()];
      BufferString.toCharArray(CommandBuffer, BufferString.length()+1); 
      Serial.print("RECEIVED DATA: "); Serial.println(CommandBuffer);
}
}
</code></pre>
]]></description><link>https://forum.mysensors.org/topic/12122/stm32f411-blackpillv2-st-core-problem-with-reading-data-from-rs485-hw-serial-2</link><generator>RSS for Node</generator><lastBuildDate>Tue, 17 Mar 2026 00:43:11 GMT</lastBuildDate><atom:link href="https://forum.mysensors.org/topic/12122.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 14 Mar 2023 10:36:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to STM32F411 BlackpillV2 ST core - problem with reading data from RS485 (HW serial 2) on Tue, 14 Mar 2023 19:34:41 GMT]]></title><description><![CDATA[<p dir="auto">OK problem found. Found out that when I selected "Blackpill F411CE" board before code compilation everything were ok.<br />
Usually I am choosing generic types so I used "F411CEUx" in case of blackpill 2 and I found out that <strong>generic types has different default "Serial" pins in ST core</strong>. Now I can confirm that Bluepill , Blackpill and F4VE board are working with MAX485.</p>
<p dir="auto">ST core v 2.4.0.</p>
<p dir="auto">../.arduino15/packages/STMicroelectronics/hardware/stm32/2.4.0/variants/STM32F4xx/F411C(C-E)(U-Y)/<strong>variant_generic.h</strong></p>
<pre><code>// UART Definitions
#ifndef SERIAL_UART_INSTANCE
  #define SERIAL_UART_INSTANCE  2
#endif

// Default pin used for generic 'Serial' instance
// Mandatory for Firmata
#ifndef PIN_SERIAL_RX
  #define PIN_SERIAL_RX         PA3
#endif
#ifndef PIN_SERIAL_TX
  #define PIN_SERIAL_TX         PA2
#endif
</code></pre>
<p dir="auto">../.arduino15/packages/STMicroelectronics/hardware/stm32/2.4.0/variants/STM32F4xx/F411C(C-E)(U-Y)/<strong>variant_BLACKPILL_F411CE.h</strong></p>
<pre><code>// UART Definitions
#ifndef SERIAL_UART_INSTANCE
  #define SERIAL_UART_INSTANCE  1
#endif

// Default pin used for generic 'Serial' instance
// Mandatory for Firmata
#ifndef PIN_SERIAL_RX
  #define PIN_SERIAL_RX         PA10
#endif
#ifndef PIN_SERIAL_TX
  #define PIN_SERIAL_TX         PA9
#endif
</code></pre>
<p dir="auto">So be carefull while using ST core and generic type of STM32.</p>
]]></description><link>https://forum.mysensors.org/post/113523</link><guid isPermaLink="true">https://forum.mysensors.org/post/113523</guid><dc:creator><![CDATA[thom4s]]></dc:creator><pubDate>Tue, 14 Mar 2023 19:34:41 GMT</pubDate></item></channel></rss>