Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 227217

Forum Post: RE: TM4C123BH6ZRB: TM4C123BH6ZRBI7

$
0
0
Hello Charles, the software runs on the launchpad without any problems. The sample code on our board also causes this error. The code we use doesn't differ much from the example code. This can be seen below: /* ISR Adc0 - Sequence 0 */ void Adc_IsrTestChASeq0() { uint32_t AdcQueue[8]; ADCIntClear( ADC0_BASE, 0); ADCSequenceDataGet( ADC0_BASE, 0, AdcQueue); /* We apply a 5 mV voltage to the ADC (PD5). If voltage below or equal 3 LSB => Red LED on else OFF */ if(AdcQueue[0] <=3) { // LED_ON GPIOPinWrite( GPIO_PORTG_AHB_BASE, PINS_MCU0_LED1, GPIO_PIN_6); // PG6 } else { // LED_OFF GPIOPinWrite( GPIO_PORTG_AHB_BASE, PINS_MCU0_LED1, ~GPIO_PIN_6); //PG6 } } int main(void) { SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_8MHZ | SYSCTL_OSC_MAIN); SysCtlDelay( DEV_EN_DELAY); SysCtlGPIOAHBEnable(SYSCTL_PERIPH_GPIOB); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); SysCtlGPIOAHBEnable( SYSCTL_PERIPH_GPIOD); SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOD); SysCtlGPIOAHBEnable( SYSCTL_PERIPH_GPIOG); SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOG); SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOM); /* enable Adc */ SysCtlPeripheralEnable( SYSCTL_PERIPH_ADC0); while(!SysCtlPeripheralReady(SYSCTL_PERIPH_ADC0)); /* enable timer for adc-measurement*/ SysCtlPeripheralEnable( SYSCTL_PERIPH_TIMER1); while(!SysCtlPeripheralReady(SYSCTL_PERIPH_TIMER1)); /* configure LED (PG6) for debugging*/ GPIOPinTypeGPIOOutput( GPIO_PORTG_AHB_BASE, GPIO_PIN_6 ); GPIOPadConfigSet( GPIO_PORTG_AHB_BASE, GPIO_PIN_6, 0, GPIO_PIN_TYPE_STD); // configure PD5 - A0 GPIOPinTypeADC( GPIO_PORTD_AHB_BASE, PINS_A0_MCU0_I ); GPIOPadConfigSet( GPIO_PORTD_AHB_BASE, PINS_A0_MCU0_I, 0, GPIO_PIN_TYPE_ANALOG); /* init ADC */ ADCReferenceSet(ADC0_BASE, ADC_REF_EXT_3V); ADCSequenceDisable(ADC0_BASE, 0); /* adc trigger by timer */ ADCSequenceConfigure( ADC0_BASE, 0, ADC_TRIGGER_TIMER, 0); /* PD5 */ ADCSequenceStepConfigure( ADC0_BASE, 0, 0, ADC_CTL_CH6 | ADC_CTL_IE | ADC_CTL_END); ADCSequenceEnable( ADC0_BASE, 0); /* isr */ ADCIntRegister( ADC0_BASE, 0, Adc_IsrTestChASeq0); ADCIntClear( ADC0_BASE, 0); ADCIntEnable( ADC0_BASE, 0); IntPrioritySet(INT_ADC0SS0, 0x00); IntEnable((uint32_t)INT_ADC0SS0); /* configure timer for adc measurement */ TimerConfigure( TIMER1_BASE, TIMER_CFG_PERIODIC); // Set timer clock source to system clock (80Mhz) TimerClockSourceSet( TIMER1_BASE, TIMER_CLOCK_SYSTEM); IntPrioritySet(INT_TIMER1A, 0x00); // should result in 80M/8000Hz = 10000 (125µs) TimerLoadSet( TIMER1_BASE, TIMER_A, 10000); // make the timer trigger an adc conversion TimerADCEventSet( TIMER1_BASE, TIMER_ADC_TIMEOUT_A); TimerControlTrigger( TIMER1_BASE, TIMER_A, true); // enable timer TimerEnable( TIMER1_BASE, TIMER_A ); while(1) {} }

Viewing all articles
Browse latest Browse all 227217


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>