主控芯片
STM32L151,利用SPI驱动lora模块,现在发现不触发中断,下边先是配置引脚
GPIO_InitTypeDef GPIO_InitStructure;
__HAL_RCC_GPIOB_CLK_ENABLE( );GPIO_InitStructure.Pin = GPIO_PIN_4; ///DIO1 PB4GPIO_InitStructure.Pull = GPIO_NOPULL;GPIO_InitStructure.Mode = GPIO_MODE_IT_RISING;GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;HAL_GPIO_Init(GPIOB, GPIO_InitStructure );
HAL_NVIC_SetPriority(EX
ti4_IRQn, 10, 0);HAL_NVIC_EnableIRQ(EXTI0_IRQn);
/
DIO0引脚中断/void EXTI4_IRQHandler(void){printf("0rn");uint16_t irqRegs;
if(
HAL_GPIO_EXTI_GET_IT(GPIO_PIN_4) != RESET){printf("0-1rn");HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_4);
irqRegs = SX126xGetIrqStatus( );SX126xClearIrqStatus( IRQ_RADIO_ALL );printf("0-2rn");if( ( irqRegs IRQ_TX_DONE ) == IRQ_TX_DONE ){//!< Update operating mode state to a value lower than ref MODE_STDBY_XOSCSX126xSetOperatingMode( MODE_STDBY_RC );LoraTxDoneCallback();printf("1");}
if( ( irqRegs IRQ_RX_DONE ) == IRQ_RX_DONE ){ if( RxContinuous == false ) { ///!< Update operating mode state to a value lower than ref MODE_STDBY_XOSC SX126xSetOperatingMode( MODE_STDBY_RC ); /// WORKAROUND - Implicit Header Mode Timeout Behavior, see DS_SX1261-2_V1.2 datasheet chapter 15.3 /// RegRtcControl = @address 0x0902 SX126xWriteRegister( 0x0902, 0x00 ); /// RegEventMask = @address 0x0944 SX126xWriteRegister( 0x0944, SX126xReadRegister( 0x0944 ) | ( 1 << 1 ) ); /// WORKAROUND END } SX126xGetPayload( RadioRxPayload, Radiosize , 255 ); SX126xGetPacketStatus( RadioPktStatus ); LoraRxDoneCallback(); printf("2");}if( ( irqRegs IRQ_CRC_ERROR ) == IRQ_CRC_ERROR ){ if( RxContinuous == false ) { //!< Update operating mode state to a value lower than ref MODE_STDBY_XOSC SX126xSetOperatingMode( MODE_STDBY_RC ); } LoraRxErrorCallback(); printf("3");}if( ( irqRegs IRQ_CAD_DONE ) == IRQ_CAD_DONE ){ //!< Update operating mode state to a value lower than ref MODE_STDBY_XOSC SX126xSetOperatingMode( MODE_STDBY_RC ); LoraCadDoneCallback(); printf("4");}if( ( irqRegs IRQ_RX_TX_TIMEOUT ) == IRQ_RX_TX_TIMEOUT ){ if( SX126xGetOperatingMode( ) == MODE_TX ) { SX126xSetOperatingMode( MODE_STDBY_RC ); LoraTxTimeoutCallback( ); printf("5"); } else if( SX126xGetOperatingMode( ) == MODE_RX ) { SX126xSetOperatingMode( MODE_STDBY_RC ); LoraRxTimeoutCallback( ); printf("6"); }}if( ( irqRegs IRQ_HEADER_ERROR ) == IRQ_HEADER_ERROR ){ if( RxContinuous == false ) { //!< Update operating mode state to a value lower than ref MODE_STDBY_XOSC SX126xSetOperatingMode( MODE_STDBY_RC ); } LoraRxTimeoutCallback( ); printf("7");}}}
可能是那些原因呢,有什么排除办法