这问题已经折腾数日,我是按照正点原子的
STM32f4的IAP程序更改了一版自己的程序,功能就是接收串口5的代码然后写入FLASH,完成之后运行APP,测试APP已经通过,并且查看FLASH代码应该是正常写入了的,但用上自己的APP始终工作异常,具体表现如下:
1. APP直接烧写工作正常。
2. APP转成BIN文件上传后工作异常,在线看BOOTLOADER的error report如附件所示报错
3.用指示灯定位发现一旦加上DMA配置则工作异常(如果屏蔽掉DMA再上传则其它功能正常),我的DMA配置如下,用于和一片DSP的SPI
通信
void SPI2_CHX_DMA_Config(void)
{
DMA_InitTypeDef DMA_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA1, ENABLE);//DMA1 奀笘妏夔
DMA_DeInit(DMA1_Stream3); //饜离 DMA
DMA_InitStructure.DMA_BufferSize = 251;//杅擂換怀講
DMA_InitStructure.DMA_Channel = DMA_Channel_0;//籵耋 0
DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)&DSPto
ARM_buffer[0];
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)&(SPI2->DR);//俋扢華硊
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;//俋扢善湔揣?耀宒
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
DMA1_Stream3 -> NDTR = 251;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; //俋扢準崝講
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_HalfFull;
DMA_InitStructure.DMA_Priority = DMA_Priority_High;//DMA_Priority_VeryHigh;
DMA_Init(DMA1_Stream3, &DMA_InitStructure);
DMA_ITConfig(DMA1_Stream3, DMA_IT_TC, ENABLE);
DMA_Cmd(DMA1_Stream3, ENABLE);
DMA_DeInit(DMA1_Stream4);
DMA_InitStructure.DMA_BufferSize = 251;
DMA_InitStructure.DMA_Channel = DMA_Channel_0;
DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)&ARMtoDSP_buffer[0];
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)&(SPI2->DR);//SPI1_DR_Addr;
DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
DMA1_Stream4->NDTR = 251;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralDataSize_Byte;
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_HalfFull;
DMA_InitStructure.DMA_Priority = DMA_Priority_High;//DMA_Priority_High;
DMA_Init(DMA1_Stream4, &DMA_InitStructure);
DMA_ITConfig(DMA1_Stream4, DMA_IT_TC, ENABLE);
DMA_Cmd(DMA1_Stream4, ENABLE);
delayms(1);
}
强调一下,我的APP是能通过
仿真器正常烧写的,而BOOTLOADER也是通过了APP测试的,但是加上了DMA配置的APP就通不过,头大!!!
请问各位高手,是不是我的DMA配置有误?像这样无法在线查看的情况,我应该使用什么样的调试方法?
多谢名位。
一周热门 更多>