I have used nRF52840 Express.
It is necessary to prevent nRD52840 from doing other things while it is charging.
so when nRD52840 is charing, I want to know USB charging status in nRF52840 Express.
How can I check this?
How can I check USB charging status in nRF52840 Express?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- kufo
- Posts: 22
- Joined: Tue Mar 21, 2023 7:05 am
- adafruit_support_bill
- Posts: 88150
- Joined: Sat Feb 07, 2009 10:11 am
Re: How can I check USB charging status in nRF52840 Express?
While it is actively charging, or any time it is connected to USB?It is necessary to prevent nRD52840 from doing other things while it is charging.
The power section of all the Feather boards is designed to automatically and transparently switch between power sources. To detect when it is plugged into USB, you could monitor the voltage on the USB pin.
To detect when it is actively charging the battery, you could position a light detector over the charge status LED. Or, with some delicate soldering, you could connect a jumper between the STAT pin of the charge controller chip and a GPIO pin.
- kufo
- Posts: 22
- Joined: Tue Mar 21, 2023 7:05 am
Re: How can I check USB charging status in nRF52840 Express?
Q: While it is actively charging, or any time it is connected to USB?
A: BOTH
and
The voltage on the USB pin is 5V, so I think that I can not use it to AI input pin in nRF52840 Express directly.
Do you know the method to check the voltage of the USB pin directly in nRF52840 Express?
and
Where is the STAT pin of the charge controller chip in nRF52840 Express?
I can not find the STAT pin in nRF52840 Express manual.
A: BOTH
and
The voltage on the USB pin is 5V, so I think that I can not use it to AI input pin in nRF52840 Express directly.
Do you know the method to check the voltage of the USB pin directly in nRF52840 Express?
and
Where is the STAT pin of the charge controller chip in nRF52840 Express?
I can not find the STAT pin in nRF52840 Express manual.
- adafruit_support_bill
- Posts: 88150
- Joined: Sat Feb 07, 2009 10:11 am
Re: How can I check USB charging status in nRF52840 Express?
You can use the same circuit that used for measuring battery voltage on the board. You would need to make a voltage divider with 2 resistors:The voltage on the USB pin is 5V, so I think that I can not use it to AI input pin in nRF52840 Express directly.
Do you know the method to check the voltage of the USB pin directly in nRF52840 Express?
https://learn.adafruit.com/introducing- ... ry-3122383
https://en.wikipedia.org/wiki/Voltage_divider
See the pinout section on page 1 of the charge controller datasheet:Where is the STAT pin of the charge controller chip in nRF52840 Express?
I can not find the STAT pin in nRF52840 Express manual.
https://ww1.microchip.com/downloads/en/ ... 01984H.pdf
- adafruit_support_bill
- Posts: 88150
- Joined: Sat Feb 07, 2009 10:11 am
Re: How can I check USB charging status in nRF52840 Express?
Looks like the processor has an internal register for USBREGSTATUS also. See pages 67 & 76 of the datasheet:
https://infocenter.nordicsemi.com/pdf/n ... S_v1.1.pdf
https://infocenter.nordicsemi.com/pdf/n ... S_v1.1.pdf
- kufo
- Posts: 22
- Joined: Tue Mar 21, 2023 7:05 am
Re: How can I check USB charging status in nRF52840 Express?
How can read an internal register for USBREGSTATUS using arduino code?
like these
5.3.7.6 EVENTS_USBDETECTED
5.3.7.7 EVENTS_USBREMOVED
5.3.7.8 EVENTS_USBPWRRDY
like these
5.3.7.6 EVENTS_USBDETECTED
5.3.7.7 EVENTS_USBREMOVED
5.3.7.8 EVENTS_USBPWRRDY
- adafruit_support_bill
- Posts: 88150
- Joined: Sat Feb 07, 2009 10:11 am
Re: How can I check USB charging status in nRF52840 Express?
You can read the contents of the register like this:
Code: Select all
uint32_t USB_Status = NRF_POWER->USBREGSTATUS;
Please be positive and constructive with your questions and comments.