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:

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
In the board drawing there is another TX-RX pair, marked #1 in PB6,PB7 and I could not get communication from there.
Baud 115200 is OK.

STM32 is no longer lonely...
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…