MCUSEL write ignored

Code is on APP processor. It is in secure mode, verified using this method: https://community.arm.com/support-forums/f/architectures-and-processors-forum/13548/for-armv8-m-is-there-a-system-register-indicating-the-security-state-of-the-core

So i try to set a pin to peripheral mode, it is ignored...

	NRF_P1_S->PIN_CNF[8] = t = (NRF_P1_S->PIN_CNF[8] &~ (GPIO_PIN_CNF_MCUSEL_Msk | GPIO_PIN_CNF_PULL_Msk | GPIO_PIN_CNF_DRIVE_Msk | GPIO_PIN_CNF_INPUT_Msk | GPIO_PIN_CNF_DIR_Msk)) |
		(GPIO_PIN_CNF_MCUSEL_Peripheral << GPIO_PIN_CNF_MCUSEL_Pos) | (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) |
		(GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
	
	printf("CNF=0x%08x, wrote 0x%08x\n", NRF_P1_S->PIN_CNF[8], t);

result is 

CNF=0x00000003, wrote 0x30000003

Docs say that to write this, i need ot be in secure mode, which i am. my code is on the app processor, to which the pin is indeed assigned. what is going on?

Parents Reply Children
  • dmitry.gr said:
    if i assign a pin to a peripheral using PSEL in a peripheral, say P1.08 to PWM0, then i should see "3" in port1's CNF[8].MCUSEL?

    Only for the peripherals with dedicated pins. PWM0 does not have dedicated pins, it can be set to use many different GPIOs. Peripherals with dedicated pins are QSPI, SPIM4 and TRACE . And also if you use Low-frequency (32.768 kHz) crystal oscillator (LFXO), this need to be connected to P0.00 and P0.01. In these cases, you will need to set CNF[#dedicated_pin].MCUSEL to Peripheral(0x3). After setting this, you will be able to see the value "3" in CNF[#dedicated_pin].MCUSEL , for these mentioned peripherals.

Related