Part Number: MSPM0G3507 Tool/software: Code Composer Studio I've been running down a bunch of problems, and it turns out that my Code Composer Studio variables window is effectively useless. It is returning completely incorrect values. I can verify by sending the values out the UART that they are what I expect while CCS is completely out to lunch. u32_adc_busy_counts should be something small--in this case: 68 (0x44) u16_adc should be 0x0FFF Correct UART values: Incorrect Variable Window with breakpoint stop: u16_res is 0 (incorrect) and u32_adc_busy_counts is 617 (0x269)? Did I miss an optimization somewhere? My "Build Configuration" claims to be "Debug" but when I compile I get: ``` [0]**** Build of configuration Debug for project gpio_toggle_output_LP_MSPM0G3507_nortos_gcc **** [1]/var/home/foo/ti/ccs2002/ccs/utils/bin/gmake -k -j 12 all -O [2]gmake[1]: 'gpio_toggle_output_LP_MSPM0G3507_nortos_gcc.out' is up to date. [3]**** Build Finished * ``` That doesn't much look like an invocation that should engage a Debug build, but I'm new to these tools. I use "Run ... Debug Project" so I think I should be in Debug modes. Any ideas? Thanks. XDS110 Debug Probe CCS: Version: 20.1.0.6__1.7.0 Code: /* * Copyright (c) 2023, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "ti/driverlib/dl_gpio.h" #include "ti/driverlib/dl_uart_main.h" #include "ti/driverlib/m0p/dl_core.h" #include "ti_msp_dl_config.h" /* This results in approximately 0.5s of delay assuming 32MHz CPU_CLK */ #define DELAY (16000000) // Approximately 1uS #define SENSE_DELAY_CYCLES (80) // Approximately 200uS #define VREF_DELAY_CYCLES (200*80) #define ADC_DELAY_CYCLES (10*80) void reset_sense_pins(void) { DL_GPIO_togglePins(GPIO_SENSE_PORT, GPIO_SENSE_DUMP_PIN); // DL_GPIO_clearPins(GPIO_SENSE_PORT, GPIO_SENSE_DUMP_PIN); DL_GPIO_enableOutput(GPIO_SENSE_PORT, GPIO_SENSE_DUMP_PIN); // DL_GPIO_setPins(GPIO_SENSE_PORT, GPIO_SENSE_DUMP_PIN); // delay_cycles(SENSE_DELAY_CYCLES); // DL_GPIO_clearPins(GPIO_SENSE_PORT, GPIO_SENSE_DUMP_PIN); // delay_cycles(SENSE_DELAY_CYCLES); // DL_GPIO_setPins(GPIO_SENSE_PORT, GPIO_SENSE_DUMP_PIN); // delay_cycles(SENSE_DELAY_CYCLES); // DRV pins can and should be driven since they are capacitively coupled // and driving them will minimize errors and coupling DL_GPIO_clearPins(GPIO_SENSE_PORT, GPIO_SENSE_DRV_0_PIN | GPIO_SENSE_DRV_1_PIN | GPIO_SENSE_DRV_2_PIN | GPIO_SENSE_DRV_3_PIN | GPIO_SENSE_DRV_4_PIN | GPIO_SENSE_DRV_5_PIN | // GPIO_SENSE_DRV_6_PIN | GPIO_SENSE_DRV_7_PIN); GPIO_SENSE_DRV_7_PIN); // FIXME: Re-add pin6 when conflicts are solved DL_GPIO_enableOutput(GPIO_SENSE_PORT, GPIO_SENSE_DRV_0_PIN | GPIO_SENSE_DRV_1_PIN | GPIO_SENSE_DRV_2_PIN | GPIO_SENSE_DRV_3_PIN | GPIO_SENSE_DRV_4_PIN | GPIO_SENSE_DRV_5_PIN | // GPIO_SENSE_DRV_6_PIN | GPIO_SENSE_DRV_7_PIN); GPIO_SENSE_DRV_7_PIN); // FIXME: Re-add pin6 when conflicts are solved } volatile bool gCheckADC = false; volatile uint16_t gAdcResult = 0xA55A; int main(void) { gCheckADC = false; NVIC_EnableIRQ(SENSE_ADC_INST_INT_IRQN); volatile uint32_t u32_ii = 0; /* Power on GPIO, initialize pins as digital outputs */ SYSCFG_DL_init(); /* Default: LED1 and LED3 ON, LED2 OFF */ u32_ii += 1; DL_GPIO_clearPins(GPIO_LEDS_PORT, GPIO_LEDS_D1_PIN); // u32_ii += 1; // DL_GPIO_setPins(GPIO_LEDS_PORT, GPIO_LEDS_D1 | // GPIO_LEDS_USER_LED_3_PIN | // GPIO_LEDS_USER_TEST_PIN); // u32_ii += 1; // DL_Timer_initCompareMode(TIM_TRIG_TIMER_INST, DL_Timer_CompareConfig *config); // void DL_Timer_setCaptureCompareValue( // GPTIMER_Regs *gptimer, uint32_t value, DL_TIMER_CC_INDEX ccIndex); // volatile uint32_t u32_ccv_0 = DL_Timer_getCaptureCompareValue(TIM_TRIG_TIMER_INST, DL_TIMER_CC_0_INDEX); // volatile uint32_t u32_ccv_1 = DL_Timer_getCaptureCompareValue(TIM_TRIG_TIMER_INST, DL_TIMER_CC_1_INDEX); // DL_Timer_setCaptureCompareValue(TIM_TRIG_TIMER_INST, 0x0100, DL_TIMER_CC_0_INDEX); // DL_Timer_setCaptureCompareValue(TIM_TRIG_TIMER_INST, 0x0200, DL_TIMER_CC_1_INDEX); // assert(TIM_TRIG_TIMER_INST_LOAD_VALUE > 0x0200); uint8_t u8_uart_msg[] = "1234567890decode\n\r"; while (DL_VREF_CTL1_READY_NOTRDY == DL_VREF_getStatus(VREF)) { // Wait for VREF } DL_ADC12_enableConversions(SENSE_ADC_INST); volatile uint32_t u32_adc_idle_counts = 0; volatile uint32_t u32_adc_busy_counts = 0; while (1) { u32_adc_idle_counts = 0; u32_adc_busy_counts = 0; u32_ii += 1; /* * Call togglePins API to flip the current value of LEDs 1-3. This * API causes the corresponding HW bits to be flipped by the GPIO HW * without need for additional R-M-W cycles by the processor. */ // for(uint32_t ui=0; ui > 8) & 0xFF); DL_UART_Main_transmitDataBlocking(UART_DBG_INST, (u32_adc_busy_counts >> 0) & 0xFF); DL_UART_Main_transmitDataBlocking(UART_DBG_INST, (u16_res >> 8) & 0xFF); DL_UART_Main_transmitDataBlocking(UART_DBG_INST, (u16_res >> 0) & 0xFF); // Put ADC reading on UART DL_ADC12_enableConversions(SENSE_ADC_INST); delay_cycles(ADC_DELAY_CYCLES); } } void SENSE_ADC_INST_IRQHandler(void) { switch (DL_ADC12_getPendingInterrupt(SENSE_ADC_INST)) { case DL_ADC12_IIDX_MEM0_RESULT_LOADED: gCheckADC = true; break; default: break; } }
↧