ch32v208 藍(lán)牙被中斷破壞

串口打印 重連也不好用 估計(jì)toms被打破了

Conn 1 - Int 28
Connected..
Update 1 - Int 6
Update 1 - Int a
RSSI -34 dB CoRun at EXTI
n? 1
RSSI -34 dB Conn? 1
RSSI -34 dB Conn? 1
Disconnected.. Reason:8
Advertising..


/***********************************

peripheral.c?? 啟動(dòng)或停止電機(jī)

static void performPeriodicTask(void)
{
??? GPIO_WriteBit(GPIOB, GPIO_Pin_6, Bit_RESET);
??? GPIO_WriteBit(GPIOC, GPIO_Pin_6, (i == 0) ? (i = Bit_SET) : (i = Bit_RESET));

}

/********************************************


peripheral_main.c

void EXTI4_INT_INIT(void)
{

內(nèi)嵌運(yùn)放的輸出為高電平就啟動(dòng)中斷
??? EXTI_InitTypeDef EXTI_InitStructure = {0};
??? NVIC_InitTypeDef NVIC_InitStructure = {0};

??? RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO , ENABLE);


??? /* GPIOA ----> EXTI_Line0 */
??? GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource4);
??? EXTI_InitStructure.EXTI_Line = EXTI_Line4;
??? EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
??? EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
??? EXTI_InitStructure.EXTI_LineCmd = ENABLE;
??? EXTI_Init(&EXTI_InitStructure);

??? NVIC_InitStructure.NVIC_IRQChannel = EXTI4_IRQn;
??? NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
??? NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
??? NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
??? NVIC_Init(&NVIC_InitStructure);
}


int main(void)
{
??? NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
??? Delay_Init();
#ifdef DEBUG
??? USART_Printf_Init( 115200 );
#endif
??? PRINT("%s\n", VER_LIB);
??? //NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
??? GPIO_INIT();
??? OPA2_Init();
??? EXTI4_INT_INIT();

??? WCHBLE_Init();
??? HAL_Init();
??? GAPRole_PeripheralInit();
??? Peripheral_Init();
??? Main_Circulation();
}

中斷
void EXTI4_IRQHandler(void)
{
? if(EXTI_GetITStatus(EXTI_Line4)!=RESET)
? {
??? printf("Run at EXTI\r\n");
??? EXTI_ClearITPendingBit(EXTI_Line4);???? /* Clear Flag */
? }
}


中斷是快進(jìn)快出,一般是不會(huì)影響藍(lán)牙的運(yùn)行情況。

注意不要在中斷里面調(diào)用的函數(shù)在FLASH運(yùn)行并且頻繁進(jìn)出中斷,可以在函數(shù)上方加上highcode,放在RAM中運(yùn)行。

需要注意函數(shù)的聲明:void?EXTI0_IRQHandler(void)?__attribute__((interrupt("WCH-Interrupt-fast")));

如果是驅(qū)動(dòng)電機(jī),則需要注意供電是否跟電機(jī)的供電分開(kāi),因?yàn)殡姍C(jī)工作需要的電流比較大,可能造成無(wú)法驅(qū)動(dòng)藍(lán)牙射頻,因此可以先單獨(dú)測(cè)試藍(lán)牙不測(cè)試電機(jī),排除電機(jī)干擾。


只有登錄才能回復(fù),可以選擇微信賬號(hào)登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频