Discuz! Board
标题:
NRF52840中断向量表重定向配置异常求助
[打印本页]
作者:
momo_qu
时间:
2021-11-5 08:36
标题:
NRF52840中断向量表重定向配置异常求助
当前产品需要重新映射中断向量,用到SCB->VTOR寄存器,但是实际测试发现,给该寄存器写入值后再读出,值不一致,造成中断响应异常,请大牛指导。
中断重定向代码配置,g_hwiForm是一个数组:
/* Interrupt vector table location */
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;
printf("[%s] g_hwiForm = %x\r\n", __func__, (UINTPTR)g_hwiForm);
printf("[%s] SCB->VTOR = %x\r\n", __func__, SCB->VTOR);
SCB->VTOR寄存器的定义,cotex-m4的标准定义:
#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
/**
\brief Structure type to access the System Control Block (SCB).
*/
typedef struct
{
__IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
__IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
__IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
__IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
__IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
__IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
__IOM uint8_t SHP[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */
__IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
__IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */
__IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */
__IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */
__IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */
__IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */
__IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */
__IM uint32_t PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */
__IM uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */
__IM uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */
__IM uint32_t MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */
__IM uint32_t ISAR[5U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */
uint32_t RESERVED0[5U];
__IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */
} SCB_Type;
log打印输出:
[HalHwiInit] g_hwiForm = 20000178
[HalHwiInit] SCB->VTOR = 20000100
作者:
momo_qu
时间:
2021-11-5 15:10
通过验证,发现寄存器值需要128字节对齐才可以设置,问题解决
欢迎光临 Discuz! Board (http://qfv8.com/)
Powered by Discuz! X3