TI中文支持网
TI专业的中文技术问题搜集分享网站

TIVA LAUNCHPAD仿真器问题。

表现是这样。用CCS5.5和大学计划的license。用luanchpad下载。同一个程序。下载程序有时候可以成功有时候不可以成功。对于不可以成功的程序在在线调试的时候发现是在外设初始化的时候进入了FaultISR。Launchpad肯定没问题。换了三四块试了,新的旧的,stellaris的也用过。

程序包含了adc0,timer0,timer1,udma。中断包含了ADC和timer1的中断。

libin sun:

这应该是你的程序有bug吧

Danny Liu:

回复 libin sun:

我查了好几天了。都是从例程里改出来的初始化方法。现在有个特点就是在线仿真是一次可以用一次会跑飞轮流循环。?

Michael Sun:

FaultISR一般是硬件层面的操作错误导致的。

楼主把代码贴出来一起看看吧。

Qian Tuo:

回复 Michael Sun:

void ADC0withDMA_init(void)
{unsigned int uIdx;for(uIdx = 0; uIdx < ADC_DSTBUF_SIZE; uIdx++){g_ulAdcBuf[uIdx] = 0;}SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);//此处顺序必须不得更改。// Enable GPIO for ADCSysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3);// Enable pin PE3 for ADC AIN0GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_2);// Enable pin PE2 for ADC AIN1GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_1);// Enable pin PE1 for ADC AIN2GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_3);// Enable pin PD3 for ADC AIN4//ADCSequenceDisable(ADC0_BASE, 1);//SysCtlADCSpeedSet(SYSCTL_ADCSPEED_250KSPS);ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_TIMER, 0);ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_CH0);ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_CH1| ADC_CTL_IE );ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_CH2);ADCSequenceStepConfigure(ADC0_BASE, 1, 3, ADC_CTL_CH4| ADC_CTL_IE |ADC_CTL_END);//ADC0_CC_R=0x01;ADCSequenceOverflowClear(ADC0_BASE,1);//不知道为什么会触发overflow中断ADCIntClear(ADC0_BASE, 1);ADCIntEnableEx(ADC0_BASE,ADC_INT_DMA_SS1);ADCIntRegister(ADC0_BASE,1,ADC0_ISR);SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);uDMAEnable();uDMAControlBaseSet(sDMAControlTable);uDMAChannelAttributeEnable(UDMA_CHANNEL_ADC1 | UDMA_PRI_SELECT,UDMA_ATTR_USEBURST|UDMA_ATTR_HIGH_PRIORITY);uDMAChannelControlSet(UDMA_CHANNEL_ADC1 | UDMA_PRI_SELECT, UDMA_SIZE_32 | UDMA_SRC_INC_NONE |UDMA_DST_INC_32 | UDMA_ARB_2);uDMAChannelTransferSet(UDMA_CHANNEL_ADC1 | UDMA_PRI_SELECT,UDMA_MODE_BASIC,(void *)(ADC0_BASE+ADC_O_SSFIFO0 - ADC_O_SSMUX0+ADC_O_SSMUX1),g_ulAdcBuf, ADC_DSTBUF_SIZE/2);uDMAChannelEnable(UDMA_CHANNEL_ADC1);ADCSequenceDMAEnable(ADC0_BASE,1);ADCSequenceEnable(ADC0_BASE, 1);
}void TimerforAdc_init(void)
{SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);while(!SysCtlPeripheralReady(SYSCTL_PERIPH_TIMER0));TimerConfigure(TIMER0_BASE, TIMER_CFG_SPLIT_PAIR|TIMER_CFG_A_PERIODIC_UP);TimerLoadSet(TIMER0_BASE, TIMER_A, 10000);//period//TimerPrescaleSet(TIMER0_BASE,TIMER_A,2);TimerControlTrigger(TIMER0_BASE, TIMER_A, true);//trigger ADC with TIMERTimerControlStall(TIMER0_BASE, TIMER_A, true);//调试时暂停计数(必要!)//SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);//GPIOPinConfigure(GPIO_PB6_T0CCP0);//GPIOPinTypeTimer(GPIO_PORTB_BASE, GPIO_PIN_6);//TimerMatchSet(TIMER0_BASE, TIMER_A,TimerLoadGet(TIMER0_BASE, TIMER_A) / 3);TimerEnable(TIMER0_BASE, TIMER_A);//TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC_UP);
}void Timerforscreen_init(void)
{SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);while(!SysCtlPeripheralReady(SYSCTL_PERIPH_TIMER1));//while(!SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1));TimerConfigure(TIMER1_BASE, TIMER_CFG_SPLIT_PAIR|TIMER_CFG_A_PERIODIC);TimerLoadSet(TIMER1_BASE, TIMER_A, 60000);//periodTimerPrescaleSet(TIMER1_BASE,TIMER_A,255);//TimerControlStall(TIMER0_BASE, TIMER_B, true);//调试时暂停计数(必要!)unsigned long ulStatus;ulStatus = TimerIntStatus(TIMER1_BASE,true);TimerIntClear(TIMER1_BASE,ulStatus);TimerIntRegister(TIMER1_BASE,TIMER_A,Timer1A_ISR);TimerIntEnable(TIMER1_BASE,TIMER_TIMA_TIMEOUT);IntEnable(INT_TIMER1A);//SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);//GPIOPinConfigure(GPIO_PB7_T0CCP1);//GPIOPinTypeTimer(GPIO_PORTB_BASE, GPIO_PIN_7);//TimerMatchSet(TIMER0_BASE, TIMER_B,TimerLoadGet(TIMER0_BASE, TIMER_B) / 3);//TimerIntClear(TIMER1_BASE,TIMER_TIMA_TIMEOUT);TimerEnable(TIMER1_BASE, TIMER_A);
}
主要就是这三个初始化嫌疑比较大。现在下载程序都要下载两遍才能用。

赞(0)
未经允许不得转载:TI中文支持网 » TIVA LAUNCHPAD仿真器问题。
分享到: 更多 (0)