This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

USB Detection

Hi,

I am working on the NRF51822 module with BLE-400 Board to develop the application.

And I need to detect the USB-Connection when it will be in the sleep mode, After detecting the USB it come back from the sleep mode to normal application working mode.

I am using Tx, Rx, and Gnd of UART Pin for the USB connection. 

So, Can you please you guide for the USB-Connect detection.

Thanks.

  • Does your board has a battery ? 

    You would need to enable a GPIO pin as wake up interrupt pin. Then in your USB cable, if you have a VDD track you can connect that to the pin to detect if the USB cable has been connected. If you don't you can pull the pin up and then connect it to the GND track to detect if the cable is connected. 

  • Yes, My Board is connected with external battery.

    Yes, I have connected the "usb_sense" pin to detect the usb when connected and it is connected to the pin 3 of NRF51822.

    Here I need to use this pin to sense the usb detection when it was in the sleep mode. After sensing(when USB get connected) I need to WAKE IT UP from sleep and start to work as per connection.

    I am gone through so many functions to develop this, I have searched and tried through various function in "bsp.c" and "bsp_btn_ble.c" to get the function for the wake up from sleep mode just same as buttons provided in the development kits and samples codes. 

    I am confused between function that how to and which function or structures to be used for the same "USB_SENSING".

    So can you provide simple button event code and configuration for led without using bsp.c and .h file.

    And I also look into app_button and gpiote file for this but I couldn't figure out how to use this file. 

    Thanks

Related