B4R Question "uart buffer full" on second Uart ESP Wemos

MbedAndroid

Active Member
Licensed User
seems that the astream_newdata isnt fired, thus uart is never read. Serial2 output is fine working.
What could be wrong. Sniffed already topics about serial2 esp, but none are working.
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 As Serial
   Private SerialNative2 As Stream
   Private astream As AsyncStreams
   Dim Timer1 As Timer
End Sub

Private Sub AppStart
   Serial1.Initialize(115200)
   RunNative("SerialNative2", Null)
   astream.Initialize(SerialNative2, "astream_NewData", "astream_Error")
   Timer1.Initialize("Timer1_Tick", 1000)
   Timer1.Enabled = True
   Log("AppStart")
End Sub

Sub astream_Error
   Log("Serialport 2 error.")
End Sub
Sub astream_NewData (s() As Byte)
   Log(s)

End Sub
Private Sub Timer1_Tick
   SendOutString("12345")

End Sub
Public Sub SendOutString(text As String)

   Dim Buffer(6) As Byte
   For i = 0 To text.Length-1
       Buffer(i)=text.GetBytes(i)
   Next
   ''Log(Buffer)
   Log("buffer send")
   astream.Write(Buffer)
End Sub
#if C
HardwareSerial Serial2(2); // Second Hardware Port
void SerialNative2(B4R::Object* unused)
{
::Serial2.begin(115200);
b4r_main::_serialnative2->wrappedStream = &::Serial2;
}
#End If
 

MbedAndroid

Active Member
Licensed User
looking into the schematics it turns out i got a mini version, with uart 2 RX on Gpio16. This is not working. The TX/RX on the pcb are serial1 uart.
Tried software serial which is working.
 
Top