Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 10 months ago.
Pins P0.26 and P0.27 disabled by default.
Is there any way to enabled those chips to act as GPIO instead of external clock oscillator? I don't have external oscillator connected to those pins and still I can't drive them.
In the mkit documentation there is information:
Quote:
If P0.26 and P0.27 are needed as normal I/Os the 32.768 kHz crystal can be disconnected and the GPIO routed to the P6 connector.
Do I have to make some change into register at the initialisation of my program to use them?
[EDIT] My program is as follows:
simple gpio test
#include "mbed.h" DigitalOut outputs[] = {(P0_0), (P0_1), (P0_2),(P0_3),(P0_4),(P0_5),(P0_6),(P0_7),(P0_8),(P0_9),(P0_10), (P0_11),(P0_12),(P0_13),(P0_14),(P0_15),(P0_16),(P0_17),(P0_18),(P0_19),(P0_20), (P0_21),(P0_22),(P0_23),(P0_24),(P0_25),(P0_26),(P0_27),(P0_28),(P0_29),(P0_30)}; //Test that all pins are working. int main() { while(1) { for (int i =0;i<=30;i++){ outputs[i]=1; wait(0.01*i); outputs[i]=0; } } }
Only those two pins are not triggering output. If you want to test it, it is here http://developer.mbed.org/teams/Icarus-Sensors/code/Pinout-Test/
And one more thing I have found. In system_nrf51822.c there is code to initialise external 32khz clock define as follows:
./targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/system_nrf51822.c
// Start the external 32khz crystal oscillator. #ifdef TARGET_HRM1017 NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_RC << CLOCK_LFCLKSRC_SRC_Pos); #else NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos); #endif NRF_CLOCK->EVENTS_LFCLKSTARTED = 0; NRF_CLOCK->TASKS_LFCLKSTART = 1;
maybe that is somehow the problem for those pins to be used as gpios that they are already define to be used for clock?
Question relating to:
1 Answer
9 years, 10 months ago.
Have you tried using those pins as GPIO using DigitalIn/DigitalOut? It should just work.