B4R Question STM32 and SoftwareSerial

derez

Expert
Licensed User
Longtime User
Running an empty program with the library rSoftwareSeriak marked and with stm32 board I get the following error:
B4R Version: 2.20
Parsing code. (0.00s)
Compiling code. (0.01s)
Building project (0.03s)
Compiling & deploying Ino project (Generic STM32F103C series - COM5) Error
Loading configuration...
Initializing packages...
Could not find boards.txt in C:\Program Files (x86)\Arduino\hardware\Arduino_STM32\examples. Is it pre-1.5?
Preparing boards...
Verifying...
In file included from D:\B4R\Test\Objects\src\src.ino:1:0:
D:\B4R\Test\Objects\bin\sketch\B4RDefines.h:22:28: fatal error: SoftwareSerial.h: No such file or directory
#include <SoftwareSerial.h>
^
compilation terminated.
exit status 1

Why isn't it found ?
 

derez

Expert
Licensed User
Longtime User
Another entity of serial refers to the same object as used for the communication with the FTDI, when init it stops the program.
There is HardwareSerial library, if possible to wrap it ...
 
Upvote 0

derez

Expert
Licensed User
Longtime User
How do I tell the program the pin numbers of serial2, serial3 ?
Will it work with the mega numbers ?
With this code it runs without fail but where do I connect ?
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public Serial1, serial2 As Serial
    Private SerialNative1 As Stream
End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
    RunNative("SerialNative1", Null)
End Sub

#If C
void SerialNative1(B4R::Object* unused) {
::Serial2.begin(9600); //<--You can change the baud rate
b4r_main::_serialnative1->wrappedStream = &::Serial2;
}
#End If

Edit: found this link http://librambutan.readthedocs.io/en/latest/lang/api/serial.html , I'll check the rx2 tx2 pins...
 
Last edited:
Upvote 0

derez

Expert
Licensed User
Longtime User
Results:
communicating with UNO that uses softwareserial, for the STM32 when I use Serial1 in the C code the pins are PA2 = TX, PA3=RX (marked in the drawing as TX2,RX2) :)
When using Serial2 the pins are PB10=TX, PB11 = RX, marked TX3, RX3. :)
Trying Serial3 -> error o_O
In the board drawing there is another TX-RX pair, marked #1 in PB6,PB7 and I could not get communication from there. o_O
Baud 115200 is OK.

STM32 is no longer lonely...
 
Last edited:
Upvote 0
Top