小弟最近在做一个AD采集系统用的是STM32,但是现在出现一个问题,我网卡用的是W5500,AD是AD7606,但是发现一个问题,我用定时器做的采样率,定时器频率一高,网口这边就连不上,导致我网口无法传输AD7606采集的数据,不知道有没有高手能解答下,W5500用的是SPI1,AD这边传输数据用的是外部中断,程序如下,希望高手可以解答下:
口开启 并执行初始化
void PWMON(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
TIM_OCInitTypeDef TIM_OCInitStructure;
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
//配置PWM输出管脚 初始化
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;//改完网口可以连接
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
//开启TIM2时钟
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE);
//配置TIM2
TIM_DeInit(TIM4);
TIM_TimeBaseStructure.TIM_Period = 36000-1;
TIM_TimeBaseStructure.TIM_Prescaler = 0;
TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1;
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseStructure.TIM_RepetitionCounter = 0;
TIM_TimeBaseInit(TIM4, &TIM_TimeBaseStructure);
//PWM模式设置 与通道设置TIM2_CH2
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM2;
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_Pulse = 72-1; //当计数器到达127时,电平发送跳变
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High; //当计数器<127时,PWM为高电平
TIM_OC2Init(TIM4, &TIM_OCInitStructure);
TIM_OC2PreloadConfig(TIM4, TIM_OCPreload_Enable);
TIM_ARRPreloadConfig(TIM4, ENABLE);
//开启TIM2
TIM_Cmd(TIM4, ENABLE);
//PWM占空比设