Hello, i have CCS5.5.000. yesterday i played a little bit with the sysclk. I changed the sysclock from 16MHz to 80Mhz.
And later the debug port was locked i dont know why. Now i can unlock the debug port with the LMFLASH, but if i power cycle the board it is locked again. And if i try to connect the locked board the CCS came with the error "Error to connecting to the target" If i press Cancel an other window with Error to connecting to the target and if i press OK CCS crashes. Any ideas?
Best regards
Franz
code:
int main(void) {
uint32_t tmp;
uint32_t pui32DataRx[3];
uint32_t pui32DataTx[3];
// uint8_t string[50];
// tmp = 0;
//
// Enable lazy stacking for interrupt handlers. This allows floating-point
// instructions to be used within interrupt handlers, but at the expense of
// extra stack usage.
//
ROM_FPUEnable ();
ROM_FPULazyStackingEnable ();
// Set the clocking to run directly from the crystal.
ROM_SysCtlClockSet (SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | /*SYSCTL_USE_PLL |*/SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
// SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);
// Enable the GPIO port that is used for the on-board LED.
ROM_SysCtlPeripheralEnable (SYSCTL_PERIPH_GPIOF);
// Enable the GPIO pins for the LED (PF2).
ROM_GPIOPinTypeGPIOOutput (GPIO_PORTF_BASE, GPIO_PIN_2);
// Enable the peripherals used by this example.
ROM_SysCtlPeripheralEnable (SYSCTL_PERIPH_UART0);
ROM_SysCtlPeripheralEnable (SYSCTL_PERIPH_GPIOA);
// set GPIO F4 for input button S1
ROM_GPIOPinTypeGPIOInput (GPIO_PORTF_BASE, GPIO_PIN_4);
ROM_GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_4, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
// Set GPIO A0 and A1 as UART pins.
ROM_GPIOPinConfigure (GPIO_PA0_U0RX);
ROM_GPIOPinConfigure (GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART (GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
//
// Configure the UART for 115,200, 8-N-1 operation.
//
//
// Initialize the UART for console I/O.
//
UARTStdioConfig(0, 115200, SysCtlClockGet());
UARTFIFOEnable(UART0_BASE);
// ROM_UARTConfigSetExpClk(UART0_BASE, ROM_SysCtlClockGet(), 115200,
// (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
// UART_CONFIG_PAR_NONE));
//
// Enable the UART interrupt.
//
ROM_IntEnable (INT_UART0);
ROM_UARTIntEnable (UART0_BASE, UART_INT_RX | UART_INT_RT);
//
// Prompt for text to be entered.
//
// UARTSend((uint8_t *)"\033[2JEnter text: ", 16);
UARTSend((uint8_t *) "FLOWSONIX LASER TEST\n\r", 22);
UARTSend((uint8_t *) "--------------------\n\r", 22);
// UARTSend((uint8_t *) " Type: Single Ended\n\r", 22);
// UARTSend((uint8_t *) " Samples: One\n\r", 16);
// UARTSend((uint8_t *) " Update Rate: 250ms\n\r", 22);
UARTSend((uint8_t *) "X=PE3 Y=PE2\n\r\n\r", 13);
//EEPROM
ROM_SysCtlPeripheralEnable (SYSCTL_PERIPH_EEPROM0);
// tmp = ROM_EEPROMSizeGet (); // ok
// UARTprintf("eeprom_size:%04d\r\n", tmp);
ROM_EEPROMRead (&PSD_ref_position[0], 4, 4);
UARTprintf("Saved zero X:%04d\t", PSD_ref_position[0]);
ROM_EEPROMRead (&PSD_ref_position[1], 8, 4);
UARTprintf("Y:%04d,\r\n\r\n", PSD_ref_position[1]);
tmp = SysCtlClockGet();
//SPI
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinConfigure(GPIO_PA2_SSI0CLK);
// GPIOPinConfigure(GPIO_PA3_SSI0FSS);
ROM_GPIOPinTypeGPIOOutput (GPIO_PORTA_BASE, GPIO_PIN_3); // A3 = output
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_3, GPIO_PIN_3);
GPIOPinConfigure(GPIO_PA4_SSI0RX);
GPIOPinConfigure(GPIO_PA5_SSI0TX);
GPIOPinTypeSSI(GPIO_PORTA_BASE,
GPIO_PIN_5 | GPIO_PIN_4 /*| GPIO_PIN_3*/| GPIO_PIN_2);
SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 8);
SSIEnable(SSI0_BASE);
// Read any residual data from the SSI port. This makes sure the receive
// FIFOs are empty, so we don't read any unwanted junk. This is done here
// because the SPI SSI mode is full-duplex, which allows you to send and
// receive at the same time. The SSIDataGetNonBlocking function returns
// "true" when data was returned, and "false" when no data was returned.
// The "non-blocking" function checks if there is any data in the receive
// FIFO and does not "hang" if there isn't.
//
while (SSIDataGetNonBlocking(SSI0_BASE, &pui32DataRx[0])) {
}
pui32DataTx[0] = 0x5555; //max 16bit
pui32DataTx[1] = 0xAAAA;
pui32DataTx[2] = 0;
//
// The ADC0 peripheral must be enabled for use.
//
// tmp = SysCtlPeripheralPresent(SYSCTL_PERIPH_ADC0);
ROM_SysCtlPeripheralEnable (SYSCTL_PERIPH_ADC1);
//
// For this example ADC0 is used with AIN0 on port PE3.
// The actual port and pins used may be different on your part, consult
// the data sheet for more information. GPIO port E needs to be enabled
// so these pins can be used.
// TODO: change this to whichever GPIO port you are using.
//
ROM_SysCtlPeripheralEnable (SYSCTL_PERIPH_GPIOE);
//
// Select the analog ADC function for these pins.
// Consult the data sheet to see which functions are allocated per pin.
// TODO: change this to select the port/pin you are using.
//
ROM_GPIOPinTypeADC (GPIO_PORTE_BASE, GPIO_PIN_3); //AIN0
ROM_GPIOPinTypeADC (GPIO_PORTE_BASE, GPIO_PIN_2); //AIN1
//
// Enable sample sequence 3 with a processor signal trigger. Sequence 3
// will do a single sample when the processor sends a signal to start the
// conversion. Each ADC module has 4 programmable sequences, sequence 0
// to sequence 3. This example is arbitrarily using sequence 3.
//
ADCSequenceConfigure (ADC1_BASE, 0, ADC_TRIGGER_PROCESSOR, 0);
//
// Configure step 0 on sequence 3. Sample channel 0 (ADC_CTL_CH0) in
// single-ended mode (default) and configure the interrupt flag
// (ADC_CTL_IE) to be set when the sample is done. Tell the ADC logic
// that this is the last conversion on sequence 3 (ADC_CTL_END). Sequence
// 3 has only one programmable step. Sequence 1 and 2 have 4 steps, and
// sequence 0 has 8 programmable steps. Since we are only doing a single
// conversion using sequence 3 we will only configure step 0. For more
// information on the ADC sequences and steps, reference the datasheet.
//
ROM_ADCSequenceStepConfigure (ADC1_BASE, 0, 0, ADC_CTL_CH0); //| ADC_CTL_IE );
ROM_ADCSequenceStepConfigure (ADC1_BASE, 0, 1, ADC_CTL_CH1 | ADC_CTL_IE | ADC_CTL_END);
//
// Since sample sequence 3 is now configured, it must be enabled.
//
ROM_ADCSequenceEnable (ADC1_BASE, 0);
// Clear the interrupt status flag. This is done to make sure the interrupt flag is cleared before we sample.
ROM_ADCIntClear (ADC1_BASE, 0);
g_ui32Counter = 0;
// Set up the period for the SysTick timer. The SysTick timer period will
// be equal to the system clock, resulting in a period of 1 second.
tmp = SysCtlClockGet();
SysTickPeriodSet(SysCtlClockGet() / 8); // SysCtlClockGet == 16Mhz
SysTickIntEnable(); // Enable the SysTick Interrupt.
SysTickEnable(); // Enable SysTick.
//
// Enable processor interrupts.
//
ROM_IntMasterEnable ();
LCD_init();
LCD_print(" --FLOWSONIX TEST-- ");
while (1) // Loop forever echoing data through the UART.
{
ROM_ADCProcessorTrigger (ADC1_BASE, 0);// Trigger the ADC conversion.
while (!ADCIntStatus(ADC1_BASE, 0, false)) { }// Wait for conversion to be completed.
ROM_ADCIntClear (ADC1_BASE, 0);// Clear the ADC interrupt flag.
ROM_ADCSequenceDataGet (ADC1_BASE, 0, pui32ADC0Value);// Read ADC Value.
// ADCSequenceDataGet(ADC0_BASE, 1, &pui32ADC0Value[1]);
//
// Display the AIN0 (PE7) digital value on the console.
//
// UARTprintf("AIN0=%04d AIN1=%04d\r\n", pui32ADC0Value[0],pui32ADC0Value[1]);
UARTprintf("%04d,\t%04d\r\n", pui32ADC0Value[0], pui32ADC0Value[1]);
// UARTprintf("printf\t");
// SSIDataPut(SSI0_BASE, pui32DataTx[0]);
// SSIDataPut(SSI0_BASE, pui32DataTx[1]);
//
// Wait until SSI0 is done transferring all the data in the transmit FIFO.
//
// while(SSIBusy(SSI0_BASE))
// {
// }
// SSIDataGet(SSI0_BASE, &pui32DataRx[0]);
// tmp = GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_4);
static unsigned char button_save;
if (!(GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_4) == GPIO_PIN_4)) {
ROM_SysCtlDelay (SysCtlClockGet() / (3 * 100)); // 100=10ms delay
if ((!(GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_4) == GPIO_PIN_4))
&& !button_save) {
button_save = true;
UARTprintf("---Save to EEPROM X:%04d Y:%04d\r\n",pui32ADC0Value[0], pui32ADC0Value[1]);
while(ROM_EEPROMStatusGet());
tmp = ROM_EEPROMProgramNonBlocking(pui32ADC0Value[0],4);
while(ROM_EEPROMStatusGet());
tmp = ROM_EEPROMProgramNonBlocking(pui32ADC0Value[1],8);
LCD_f(C_LINE_4);
LCD_print("zero Position saved");
ROM_SysCtlDelay (SysCtlClockGet() / (3 * 1)); // 1=1sec. 2=0,5sec.
LCD_f(C_LINE_4);
LCD_print(" ");
}
}
else
{
button_save = false;
}
LCD_f(C_LINE_2);
usprintf(lcd_string, "Cnt:%d", systickcounter);
LCD_print(lcd_string);
LCD_f(C_LINE_3);
usprintf(lcd_string, " X:%04d Y:%04d", pui32ADC0Value[0], pui32ADC0Value[1]);
LCD_print(lcd_string);
// This function provides a means of generating a constant length // delay. The function delay (in cycles) = 3 * parameter. Delay
// 250ms arbitrarily.
ROM_SysCtlDelay (SysCtlClockGet() / (3 * 10)); // 1=1sec. 2=0,5sec.
}
}