BG96 - can't start USB and use it to interface with app

So the thing is that I need to be able to exchange some data with app using USB.
API document says there should be qapi_QT_Usbmode_Set and qapi_QT_Get_USB_Event which are not declared in any .h files in SDK.
SDK has qapi_USB_Open() and other functions declared in qapi_usb.h, so when I call them I never get positive result.
Where I can find more information or maybe some code example of USB interface usage for user data ?

Hi Grisha,

APIs like qapi_QT_*** you can use directly. And USB confiuration takes effect after reboot. And also make sure that USB function is enabled before you call qapi_USB_open().

Best Regards,

Hi,

Actually when I use qapi_QT_ around USB I get error that it’s not declared. USB configuration before qapi_USB_open - what exactly you mean ? I don’t see any related functions in SDK.
Maybe you can share some simple example project illustrating that ?
Btw, I am using LLVM, SDK BG96MAR04A03M1G_02.003.01.003

Regards
Grigor

The USB is not shared for the user (my info is from a year ago, if it’s new i don’t know)
All USB endpionts is used from resident (Quectel) application

  • DM Port
  • AT Port
  • NMEA PORT
  • etc…

There are USB open, read and write operations.
Quite from qapi_usb.h

 * @addtogroup qapi_usb
 * @{
 *
 * These USB APIs enable clients to open a USB channel to allow data transfers
 * between the client and the device without a specific packet format.
 *
 * @code

So it should work, just I don’t fully get how. I can’t find right now but I saw note that NMEA port used for that.

what return qapi_USB_Open()

-1 . I was not able to find matching define for it

That’s mean: cannot open serial ( kernel ) driver for “this serial port”

  • -1 is complex error from many errors
  • -160001 already open
  • 0 ok

Well, that is definitely -1 and it shows that port can’t be open.
Tried qapi_QT_Usbmode_Set(1) and that kills all usb ports after restart, but qapi_USB_Open() still drops -1.
I feel I am missing some small detail…

You know what is strange that on first call I get -1. On all further calls I get -160001. But why if open failed before ?

:grinning:
maybe Quectel should say where the problem is

Hope so… But overall USB part is quite blurry in datasheets. For BG95 for example there is different definition.
qapi_QT_ USB_Sio_Open,qapi_QT_ USB_Sio_Close, qapi_QT_ USB_Sio_Transmit. No Read ???
But note there shows that is just debug output. “This function
is used to open USB NMEA port for output customer application log which is used for
debug ging purpose.”
But same time in USB.h there are still same functions as in BG96 SDK

Looks no goodies this time, I hoped to minimize parts amount, but looks will need to add usb-uart bridge :confused:

I thing, this serial is not mapped to HSUSB driver
Maybe exist USB setting … /nv/item_files/conf/hsusb

Got confirmation from Quectel - USB usage from user app is not supported.
Looks it’s time to choose good usb-uart bridge…

2 Likes