问答

汇集网友智慧,解决技术难题

21ic问答首页 - TAG - MM32F031
  • 关于MM32F031 q版正常和n版不工作

    使用q版配置工程文件,编译后下载到q版芯片可以正常运行;但如果下载到n版或o版,不能正常运行。查了下datasheet,里面只有最后型号命名提到q和n是指core version,但没提这2个版本具体区别。是否需要使用对应的启动文件:比如system_MM32F031x4x6_q.c和startup_MM32F031x4x6_q.s,需要更换,其它库文件也需要更换?目前没找到n版和o版的这方面资料。 如何才能让n版和o版也能工作起来?

    嵌入式 MM32F031

    7570浏览量 12回复量 关注量
  • MM32F031K6T的ADC转换速率好像达不到1Msps

    我使用库例程,时钟使用HSI,72MHz,APB2不分频;ADC_PRESCARE设置为12; 设置采样通道2个,通道采样时间在55.5周期以上,符合数据手册。但如果采样时间设置为13.5周期,却达不到111ksps,任何低于55.5周期的设置,都只能达到65ksps左右;或者ADC_PRESCARE设置为11及以下,提高ADC时钟,也都只能达到65ksps左右;请问瓶颈在哪儿?下面是ADC配置和时钟配置 //ADC配置,2个采样通道 void ADCMultiChannelInit(){ GPIO_Config_AIN(GPIOA, GPIO_Pin_1); GPIO_Config_AIN(GPIOA, GPIO_Pin_3); ADC_InitTypeDef ADC_InitStructure; ADC_StructInit(&ADC_InitStructure); //Initialize PA1 to analog input mode RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); //Enable ADC clock ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b; ADC_InitStructure.ADC_PRESCARE = ADC_PCLK2_PRESCARE_12; //ADC prescale factor ADC_InitStructure.ADC_Mode = ADC_Mode_Continuous_Scan; //Set ADC mode to continuous conversion mode ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; //AD data right-justified ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1; ADC_Init(ADC1, &ADC_InitStructure); ADC_RegularChannelConfig(ADC, ADC_Channel_DisableAll, 0, ADC_SampleTime_13_5Cycles);//Block all channels ADC_RegularChannelConfig(ADC1, ADCch1, 0, ADC_SampleTime_13_5Cycles);//Enable the channel ADC_RegularChannelConfig(ADC1, ADCch2, 0, ADC_SampleTime_13_5Cycles);//Enable the channel #ifdef ADC_USE_DMA ADC_DMACmd(ADC1, ENABLE); //Enable ADCDMA #else ADC_ITConfig(ADC1, ADC_IT_EOC, ENABLE); //DMA interrupt initialization NVIC_InitTypeDef NVIC_InitStruct; NVIC_InitStruct.NVIC_IRQChannel = ADC_COMP_IRQn; NVIC_InitStruct.NVIC_IRQChannelPriority = 0; NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStruct); #endif ADC_Cmd(ADC1, ENABLE); //Enable AD conversion } //DMA配置 void ADC_DMAInit(void) { DMA_InitTypeDef DMA_InitStructure; NVIC_InitTypeDef NVIC_InitStruct; RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE); DMA_DeInit(DMA1_Channel1); DMA_InitStructure.DMA_PeripheralBaseAddr = (u32) & (ADC1->ADDATA); //DMA transfer peripheral address DMA_InitStructure.DMA_MemoryBaseAddr = (u32)&ADCValue; //DMA transfer memory address DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC; //DMA transfer direction from peripheral to memory DMA_InitStructure.DMA_BufferSize = 2; //DMA cache size DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; //After receiving the data, the peripheral address is forbidden to move backward DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; //After receiving the data, the memory address is shifted backward DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord; //Define the peripheral data width to 16 bits DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord; //Define the memory data width to 16 bits DMA_InitStructure.DMA_Mode = DMA_Mode_Circular; //Cycle conversion mode DMA_InitStructure.DMA_Priority = DMA_Priority_High; //DMA priority is high DMA_InitStructure.DMA_M2M = DMA_M2M_Disable; //M2M mode is disabled DMA_Init(DMA1_Channel1, &DMA_InitStructure); DMA_Cmd(DMA1_Channel1, ENABLE); DMA_ITConfig(DMA1_Channel1, DMA_IT_TC, ENABLE); //DMA interrupt initialization NVIC_InitStruct.NVIC_IRQChannel = DMA1_Channel1_IRQn; NVIC_InitStruct.NVIC_IRQChannelPriority = 0; NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStruct); ADCTrigFilterflag = 0; } //ADCDMA中断处理 u32 measCount; void DMA1_Channel1_IRQHandler(void) { // ADC_SoftwareStartConvCmd(ADC1, DISABLE); //Stop Conversion DMA_ClearITPendingBit(DMA1_IT_TC1); //Clear interrupt flag u16 chan = 0; measCount++; // ADC_SoftwareStartConvCmd(ADC1, ENABLE); // ADCflag = 1; //Erected transmission complete flag } //72M时钟配置 void SetSysClockTo72_HSI(void) { unsigned char temp = 0; unsigned int temp1 = 0; RCC->CR |= RCC_CR_HSION; while (!(RCC->CR & RCC_CR_HSIRDY)) ; RCC->CR |= (1 << 20); RCC->CR &= ~(1 << 2); RCC->CFGR = RCC_CFGR_PPRE1_2; FLASH->ACR = FLASH_ACR_LATENCY_2 | FLASH_ACR_PRFTBE; RCC->CFGR |= (uint32_t)RCC_CFGR_HPRE_DIV1; /* PCLK2 = HCLK PRE2 divide*/ RCC->CFGR |= (uint32_t)RCC_CFGR_PPRE2_DIV1; /* PCLK1 = HCLK PRE1 divide */ RCC->CFGR |= (uint32_t)RCC_CFGR_PPRE1_DIV1; RCC->CFGR &= ~RCC_CFGR_SW; temp1 = *(u16 *)0x1FFFF7FA; if ((temp1 & 0xff) == 0xff) { temp1 &= 0xff00; } else { temp1 &= 0xff; temp1 <<= 8; } temp1 |= (RCC->CR & 0xFFFF00ff) | 0xf8; RCC->CR = temp1; RCC->CFGR |= RCC_CFGR_SW_HSI; while (1) { temp = RCC->CFGR; temp = temp >> 2; temp &= RCC_CFGR_SW; if(temp == RCC_CFGR_SW_HSI) break; } }

    MM32F031 ADC SPS

    10219浏览量 16回复量 关注量
  • MM32F031f6p6 GPIO没电平输出

    用 MM32F031f6p6 代替 stm32f030f4P6出现GPIO口电平没输出,我是直接用stm32f030f4p6工程来调试mmf031f6p6的。 void gpio_delay(int cnt) { while(cnt--); } void gpio_init(void) { GPIO_InitTypeDef out; RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE); out.GPIO_Pin = GPIO_Pin_7; out.GPIO_Mode = GPIO_Mode_OUT; out.GPIO_Speed = GPIO_Speed_10MHz; GPIO_Init(GPIOA, &out); while(1) { GPIO_SetBits(GPIOA, GPIO_Pin_7); gpio_delay(60000); GPIO_ResetBits(GPIOA, GPIO_Pin_7); gpio_delay(60000); } } 用官网的代码,用st-link debug程序没点击keil的start按钮就直接运行,也会报错,这会是什么问题? 上传不了图片 官网工程路径:Boards_MM32F031xx_q\MBF031C6T_q_lib\EXTI\EXTI_KEY\KEIL_PRJ

    MM32F031 GPIO 电平 ni While

    10036浏览量 9回复量 关注量
  • 请教MM32F031G6U6分Q版与N版吗? sos

    请教MM32F031G6U6分Q版与N版吗?如果分,如何看自己买的芯片是什么版本?多谢!

    MM32F031 芯片

    1247浏览量 0回复量 关注量
  • MM32F031X6 GPIO无法使能

    有人遇到过这个问题吗?时钟寄存器一直保持默认值0x14 下载视频

    GPIO MM32F031 寄存器 时钟

    1058浏览量 8回复量 关注量