Other Parts Discussed in Thread: UNIFLASH
Tool/software: Code Composer Studio
I ran into the error messages below when I originally tried to program my MSP432P401R Launchpad with the code below.
CORTEX_M4_0: Flash Programmer: Reading device TLV failed.
CORTEX_M4_0: Error initializing flash programming: Your XMS432P401R material is no longer supported. We recommend you moving to production-quality MSP432P401R/M silicon by ordering samples at www.ti.com/product/MSP432P401R.
CORTEX_M4_0: Loader: One or more sections of your program falls into a memory region that is not writable. These regions will not actually be written to the target. Check your linker configuration and/or memory map.
CORTEX_M4_0: Can't Run Target CPU: (Error -1268 @ 0x3090001) Device is locked up in Hard Fault or in NMI. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 8.2.0.00004)
This happened when I tried to program the Clock System SysTick timer with the resister-level code below. For what it's worth, I redundantly set the bus clock to 48MHz in the the "system_msp432p401r.c" file of the project as well. I was only able to unlock my board by programming it with the Keil MicroVision IDE through the "CMSIS-DAP Debugger" setting for loading any arbitrary program.
Incidentally, after unlocking it using the Keil IDE, I am now able to successfully program the exact same code below using the CCS IDE with no problem (still have the redundant clock configuration).
Can anyone give me any insight in to what happened to lock the board, as well as a way to unlock it using CCS instead of Keil?
#include "msp.h" // System clock (MCLK) is set to 48 MHz in the system. (20.83 ns) void CS_Init(){ CS->KEY = CS_KEY_VAL ; // Unlock CS module for register access CS->CTL0 = 0; // Reset tuning parameters CS->CTL0 = CS_CTL0_DCORSEL_5; // Set DCO to 48MHz // Select ACLK = REFO, SMCLK = MCLK = DCO CS->CTL1 = CS_CTL1_SELA_2 | CS_CTL1_SELS_3 | CS_CTL1_SELM_3; CS->KEY = 0; // Lock CS module from unintended accesses } void main(void){ P1DIR |= BIT0; //Make Pin 0 of P1 and output (Red LED) CS_Init(); // Initialize the system timer clock (MCLK) to 48 MHz SysTick->LOAD = 16000000; // Set Timer Period to 16 million ticks (1/4 sec) SysTick->CTRL = 0x00000007; // enable SysTick with core clock and enable SysTick Interrupt __enable_irq(); while(1){ P1OUT ^= BIT0; //Toggle the Red LED __sleep(); //Enter low power mode while waiting for timer interrupt } } void SysTick_Handler(void) { _nop(); }