I have a hardware development with a CP2104 USB-Serial chip. With B4A App I am able to interface with this chip easily, and read from it a stream of data. The basic code that I use in this case is:
In B4J I have used the Chat example App that uses the jSerial Lib, to open the COM port that the PC assigned to the CP2104. I can send data from the PC to the CP2104…but I can’t get the data stream from the CP2104 to the PC
I don´t know how to go on. Thanks in advance for your help
B4A code:
Dim usb1 as UsbSerial
Dim astreams1 As AsyncStreams
…
usb1.SetCustomDevice(usb1.DRIVER_SILABS, 0x10C4,0xEA61)
Dim dev As Int
dev = usb1.Open(460800, 1)
usb1.SetParameters(460800, usb1.DATABITS_8, usb1.STOPBITS_1, usb1.PARITY_NONE)
If dev <> usb1.USB_NONE Then
Log(“Connected”)
End If
…
Sub Astreams1_NewData (Buffer() As Byte)
‘ Here I read the data
End Sub
In B4J I have used the Chat example App that uses the jSerial Lib, to open the COM port that the PC assigned to the CP2104. I can send data from the PC to the CP2104…but I can’t get the data stream from the CP2104 to the PC
I don´t know how to go on. Thanks in advance for your help