Identifying status of usb is just Charging or usb is connected.

Hello!!

I'm using USB C Type port to Charging battery and USB mass storage class.

My development platform is nRF5340 with nRF Connect SDK in MacOS.

In my known information, Writing file and mass storage class is not working in parallel.

So, I want to know how to identify usb is connected or just charing state.

In my use case, I want to write sensor data file when usb is not connected.

Thanks!!

  • Hi

    Can you explain what you mean about "writing file" here? Do you have some source on where you've seen that MSC and writing file doesn't work in parallel? The USB state module registers the CONFIG_USB_HID_DEVICE_COUNT instances, and reports the necessary callbacks to the device to ensure that the state of the USB connection is tracked with the following USB states:

    These states are broadcast by the USB state module with a USB_STATE_EVENT. So you should be able to check the USB state event if you only want to do these "write files" operation when the USB state is disconnected or suspended for example.

    Best regards,

    Simon

Related