Quantcast
Channel: MSP low-power microcontrollers
Viewing all articles
Browse latest Browse all 62309

Forum Post: Using External Crystal on MSP432 Launchpad using RTL OS

$
0
0
Hello everyone! Spent some days trying to figure out something but... so here i am today :) I'm using MSP432 Launchpad with multi-tasking with RTL.h. The code works fine (well almost... ^^"). The problem now is that i can't program the main clock MCLK to be sourced on the external crystal of the launchpad. I used the same code as the TI example one, which works fine alone, but doesn't on my application. With an oscilloscope i notice a MCLK at 5MHz (or 2.5 if i divide), so i guessed this was the fail-proof SYSOSC because my HFXT doesn't work. I tried to enable interrupts with CS_enableInterrupt(CS_HFXT_FAULT) and that brought me in an endless loop in NMI-Handler. I hope I've been understood, sorry for my french accent :/ , and thanks for every comment you could have to find a new path :) Here is my code: CS_setExternalClockSourceFrequency(32768,48000000); //set frequency of external oscilators GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_PJ,GPIO_PIN1,GPIO_PRIMARY_MODULE_FUNCTION); GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_PJ,GPIO_PIN0,GPIO_PRIMARY_MODULE_FUNCTION); //set PJ.0 as special input for LF crystal GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_PJ,GPIO_PIN2,GPIO_PRIMARY_MODULE_FUNCTION); GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_PJ,GPIO_PIN3,GPIO_PRIMARY_MODULE_FUNCTION); //set PJ.3 as special input for LF crystal PCM_setCoreVoltageLevelWithTimeout(PCM_VCORE1,10000); noerror=CS_startHFXT(false); //set external HF oscilator , no bypass CS_startLFXT( CS_LFXT_DRIVE3); //set external LF oscilator, no bypass CS_initClockSignal(CS_ACLK,CS_LFXTCLK_SELECT,CS_CLOCK_DIVIDER_1); //ACLK on LF crystal CS_initClockSignal(CS_MCLK,CS_HFXTCLK_SELECT,CS_CLOCK_DIVIDER_2); //MCLK on HF crystal CS_initClockSignal(CS_BCLK,CS_LFXTCLK_SELECT,CS_CLOCK_DIVIDER_1); //BCLK on LF crystal CS_initClockSignal(CS_SMCLK,CS_HFXTCLK_SELECT,CS_CLOCK_DIVIDER_2); //SMCLK on HF crystal CS_initClockSignal(CS_HSMCLK,CS_HFXTCLK_SELECT,CS_CLOCK_DIVIDER_2); //HSMCLK on HF crystal CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_1_5); //set DCO at 1.5MHz Mclk=CS_getMCLK(); /*CS_enableFaultCounter(CS_HFXT_FAULT_COUNTER); CS_startFaultCounter(CS_HFXT_FAULT_COUNTER,CS_FAULT_COUNTER_4096_CYCLES); CS_resetFaultCounter(CS_HFXT_FAULT_COUNTER); Interrupt_enableMaster(); CS_enableInterrupt(CS_STARTCOUNT_HFXT_FAULT);*/ we can notice that the LFCLK does work correctly

Viewing all articles
Browse latest Browse all 62309

Trending Articles