0

I want to connect some custom USB CDC device(STM32) to android phone. I already have made most of other parts of app in the Visual Studio 2022 with xamarin for android. Based on my internet search I will need some external lib for xamarin USB android combination. Most internet sources direct to this lib: https://github.com/anotherlab/UsbSerialForAndroid

However, I find their example code very strange. I have looked at the code but I don't really know which part is doing what. Another problem is that I was not able to run the example app , to compare it with code...

Can anybody please show me some simplest example code with this lib? Something like this:

  • connect to USB CDC device if found
  • listen to com rx port if any char has been received

thanks

  • What specific problem are you having with the sample code? It is difficult to help you when you don’t provide any details. – Jason Mar 04 '23 at 09:22
  • A USB port is a standard serial port where you set the baud rate depending on the device. You have to first search through the list of ports to find the one that matches the name you are looking for to get the comm number. In your case you want to create a receive event to listen for any characters. So start by finding the device. You STM32 probably has jumper options that have to be set correctly. And you need that correct type cable. Read following : https://wiki.st.com/stm32mcu/wiki/Introduction_to_USB_with_STM32 – jdweng Mar 04 '23 at 09:23

0 Answers0