B4J Question CP2104 USB-Serial chip management in B4J and in B4A

Cesaral

Member
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:

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
 

kimstudio

Active Member
Licensed User
Longtime User
Post your B4J code and device serial spec parameters may help. jSerial works greatly at my side for other usb-serial chips.
 
Upvote 0
Top