Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nrf: Incorrect pin voltages #1174

Closed
dhalbert opened this issue Sep 8, 2018 · 9 comments
Closed

nrf: Incorrect pin voltages #1174

dhalbert opened this issue Sep 8, 2018 · 9 comments
Assignees
Labels
Milestone

Comments

@dhalbert
Copy link
Collaborator

dhalbert commented Sep 8, 2018

The nRF52840 can be set to supply different voltages on its GPIO pins. If the chip is used in "high voltage mode" (so-called due to how the internal regulators are used and how the VDD and VDDH pins are connected), then the UICR->REGOUT0 register can be used to vary the voltage on the GPIO pins.

The PCA10059 dongle is set up to use "high voltage mode".

If you erase the NVM (say with some firmware erase command), then the UICR->REGOUT0 register is set to all 1's, and it uses the default voltage of 1.8V. I verified this with a random GPIO pin.

Both @jerryneedell and I noticed this, because the on-board red LED was really dim and the RGB led would only display red (because the green and blue parts need >1.8v). We had both erased the NVM before loading a new bootloader.

The temporary fix is to go into gdb and do:

(gdb) set *0x10001304 = 5

and then reset the board (it won't take effect without a reset, it appears).

This will set UICR->REGOUT0 to use 3.3V as the specified voltage.

The real fix is to make CircuitPython check the value of this register on startup and change it to 0x5 if it's not already. Let's not write it every time so as not to wear the NVM.

The PCA10056 appears to be wired differently and is in "normal voltage mode", not "high voltage mode". In normal mode the value of REGOUT0 has no effect.

However, measuring a HIGH on a random GPIO pin on the PCA10056 shows about 3.04V, so that's another puzzle.

I haven't looked yet at how the Feather nRF52840 is powered; probably it is in normal mode and uses an external regulator to get 3.3V.

The nRF52832 does not have REGOUT0.

Tagging @jerryneedell @arturo182 @tannewt @ladyada @hathach for a heads-up.

PCA10059 issue also noted here: https://devzone.nordicsemi.com/f/nordic-q-a/38205/flashing-pca10059

@dhalbert dhalbert added this to the 4.0 Alpha milestone Sep 8, 2018
@dhalbert dhalbert self-assigned this Sep 8, 2018
@dhalbert dhalbert added the nordic label Sep 8, 2018
@ladyada
Copy link
Member

ladyada commented Sep 8, 2018

OK - i did notice the high voltage on my PCA DK was a tad lower than expected, my neopixels were not happy about it.

@jerryneedell
Copy link
Collaborator

Nice! the set *0x10001304 = 5 worked ! -- nice blinking RGB now!

@jerryneedell
Copy link
Collaborator

@dhalbert FWYi after setting this register I now see that the JLink reports the target voltage as 3.29V rathere than 1.78V as it did before the change. I have my JLink connected to the VDDOut pad but from the Schematic, this should be the VDDnRF which is pin 1 on the SWD header.

before setting register

jerryneedell@Ubuntu-Macmini:~/projects/nrf52_dongle$ JLinkGDBServer -if SWD -device NRF52832_XXAA
SEGGER J-Link GDB Server V6.30h Command Line Version

JLinkARM.dll V6.30h (DLL compiled Mar 16 2018 18:04:35)

Command line: -if SWD -device NRF52832_XXAA
-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     2331
SWO raw output listening port: 2332
Terminal I/O port:             2333
Accept remote connection:      yes
Generate logfile:              off
Verify download:               off
Init regs on start:            off
Silent mode:                   off
Single run mode:               off
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 none
J-Link settings file:          none
------Target related settings------
Target device:                 NRF52832_XXAA
Target interface:              SWD
Target interface speed:        4000kHz
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V10 compiled Mar  2 2018 17:07:17
Hardware: V10.10
S/N: 260101649
OEM: SEGGER-EDU
Feature(s): FlashBP, GDB
Checking target voltage...
Target voltage: 1.78 V

after setting register
set *0x10001304 = 5

jerryneedell@Ubuntu-Macmini:~/projects/nrf52_dongle$ JLinkGDBServer -if SWD -device NRF52832_XXAA
SEGGER J-Link GDB Server V6.30h Command Line Version

JLinkARM.dll V6.30h (DLL compiled Mar 16 2018 18:04:35)

Command line: -if SWD -device NRF52832_XXAA
-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     2331
SWO raw output listening port: 2332
Terminal I/O port:             2333
Accept remote connection:      yes
Generate logfile:              off
Verify download:               off
Init regs on start:            off
Silent mode:                   off
Single run mode:               off
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 none
J-Link settings file:          none
------Target related settings------
Target device:                 NRF52832_XXAA
Target interface:              SWD
Target interface speed:        4000kHz
Target endian:                 little

J-Link is connected.
Firmware: J-Link V10 compiled Mar  2 2018 17:07:17
Hardware: V10.10
S/N: 260101649
OEM: SEGGER-EDU
Feature(s): FlashBP, GDB
Checking target voltage...
Target voltage: 3.29 V

@jerryneedell
Copy link
Collaborator

also interesting, - I did not notice that the JLink identified the Dongle as a n NRF52832_XXAA -- it a all worked OK!

@jerryneedell
Copy link
Collaborator

hmm -- that was shortlived - I may have shorted something, but I appear to have fried another Dongle. I now see only .5V on VDDOut and the board is non functional. It's possible I shorted VDDOut to GND when connecting the JLink. Not sure if this would kill it. Just wanted to pass on a waring. Luckily theses boards are only $10. I have one more, but want to tread carefully before I kill another one! Should have a few more soon. Mouser is backorder, Symmetry claims to have them....

@jerryneedell
Copy link
Collaborator

Took a chance with my remaining dongle -- Flashed the bootloader and set the Register
for 3.3V GPIO then loaded CP 4.0 master.

All seems to be working well.
Noted that JLink now still sees the target voltage as 1.8V but measuring VDDOut shows 3.3V
Hopefully that makes sense...

jerryneedell@Ubuntu-Macmini:~/projects/adafruit_github/Adafruit_nRF52_Bootloader$ JLinkGDBServer -if SWD -device NRF52840_XXAA 
SEGGER J-Link GDB Server V6.30h Command Line Version

JLinkARM.dll V6.30h (DLL compiled Mar 16 2018 18:04:35)

Command line: -if SWD -device NRF52840_XXAA
-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     2331
SWO raw output listening port: 2332
Terminal I/O port:             2333
Accept remote connection:      yes
Generate logfile:              off
Verify download:               off
Init regs on start:            off
Silent mode:                   off
Single run mode:               off
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 none
J-Link settings file:          none
------Target related settings------
Target device:                 NRF52840_XXAA
Target interface:              SWD
Target interface speed:        4000kHz
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V10 compiled Mar  2 2018 17:07:17
Hardware: V10.10
S/N: 260101649
OEM: SEGGER-EDU
Feature(s): FlashBP, GDB
Checking target voltage...
Target voltage: 1.83 V
Listening on TCP/IP port 2331
Connecting to target...Connected to target
Waiting for GDB connection...

@jerryneedell
Copy link
Collaborator

and to confirm taht I am still confused, but it is still working -- now Jlink reports the 3.3V target

jerryneedell@Ubuntu-Macmini:~/projects/nrf52_dongle$ JLinkExe
SEGGER J-Link Commander V6.30h (Compiled Mar 16 2018 18:04:43)
DLL version V6.30h, compiled Mar 16 2018 18:04:35

Connecting to J-Link via USB...O.K.
Firmware: J-Link V10 compiled Mar  2 2018 17:07:17
Hardware version: V10.10
S/N: 260101649
License(s): FlashBP, GDB
OEM: SEGGER-EDU
VTref = 3.350V


Type "connect" to establish a target connection, '?' for help
J-Link>
Unknown command. '?' for help.
J-Link>connect
Please specify device / core. <Default>: NRF52840_XXAA
Type '?' for selection dialog
Device>
Please specify target interface:
  J) JTAG (Default)
  S) SWD
TIF>S
Specify target interface speed [kHz]. <Default>: 4000 kHz
Speed>
Device "NRF52840_XXAA" selected.


Connecting to target via SWD
Found SW-DP with ID 0x2BA01477
Found SW-DP with ID 0x2BA01477
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x24770011)
AP[1]: JTAG-AP (IDR: 0x02880000)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
Cortex-M4 identified.
J-Link>

@dhalbert
Copy link
Collaborator Author

dhalbert commented Sep 8, 2018

I spent a lot of time probing on the board, and finally read the documentation as well. The PCA10056 DK board deliberately uses a 3V (not 3.3V) regulator (U11) to power VDD on the nRF52840. So the output pin voltages are going to be 3.0V instead of 3.3V.

See http://infocenter.nordicsemi.com/pdf/nRF52840_DK_User_Guide_v1.2.pdf

🙁

@dhalbert
Copy link
Collaborator Author

Fixed by #1177.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants