정식으로 드라이버와 데이터 시트를 받지 못했을 경우 인터럽트 벡터 위치를 직접 확인해서 넣어야하는 경우가 있습니다.
그럴때 다소 귀찮긴 하지만 하나씩 인터럽트 벡터를 살린 후 데이터가 들어오는 인터럽트 벡터 번호를 찾아서 매핑해주면 사용할 수 있습니다.
Uart0번의 벡터를 체크한 부분입니다. 인터럽트와 별도로 Uart 설정은 따로 해주어야 합니다.
void INT_All_Enable(void)
{
int Interrupt_Vector_Num = 0;
DEBUGPRINT("\r\n NORMAL MODE TEST");
for( Interrupt_Vector_Num= 0; Interrupt_Vector_Num < 239; Interrupt_Vector_Num++){
NVIC_ClearPendingIRQ(Interrupt_Vector_Num);
NVIC_EnableIRQ(Interrupt_Vector_Num);
}
}
xxxx_it.h
void NMI_Handler(void)
{
}
void HardFault_Handler(void)
{
}
void MemManage_Handler(void)
{
}
void BusFault_Handler(void)
{
}
void UsageFault_Handler(void)
{
}
void SVC_Handler(void)
{
}
void DebugMon_Handler(void)
{
}
void PendSV_Handler(void)
{
}
void SysTick_Handler(void)
{
UART0_Printf("SysTick_Handler\r\n");
}
void UART0_IRQHandler(void)
{
UART0_Printf("UART0_IRQHandler\r\n");
}
void DUALTIMER0_Handler(void)
{
}
void TIMER0_IRQHandler(void)
{
}
void TIMER1_IRQHandler(void)
{
}
void UNKNOWN0_IRQHandler(void){UART0_Printf("UNKNOWN0_IRQHandler\r\n");}
void UNKNOWN1_IRQHandler(void){UART0_Printf("UNKNOWN1_IRQHandler\r\n");}
void UNKNOWN2_IRQHandler(void){UART0_Printf("UNKNOWN2_IRQHandler\r\n");}
void UNKNOWN3_IRQHandler(void){UART0_Printf("UNKNOWN3_IRQHandler\r\n");}
void UNKNOWN4_IRQHandler(void){UART0_Printf("UNKNOWN4_IRQHandler\r\n");}
......... 중략 ............
void UNKNOWN237_IRQHandler(void){UART0_Printf("UNKNOWN237_IRQHandler\r\n");}
core_cm.h
/*
* ==========================================================================
* ---------- Interrupt Number Definition -----------------------------------
* ==========================================================================
*/
typedef enum IRQn
{
/****** Cortex-M3 Processor Exceptions Numbers ***************************************************/
NonMaskableInt_IRQn = -14, /*!< 2 Cortex-Mx Non Maskable Interrupt */
HardFault_IRQn = -13, /*!< 3 Cortex-Mx Hard Fault Interrupt */
MemoryManagement_IRQn = -12, /*!< 4 Cortex-Mx Memory Management Interrupt */
BusFault_IRQn = -11, /*!< 5 Cortex-Mx Bus Fault Interrupt */
UsageFault_IRQn = -10, /*!< 6 Cortex-Mx Usage Fault Interrupt */
SVCall_IRQn = -5, /*!< 11 Cortex-Mx SV Call Interrupt */
DebugMonitor_IRQn = -4, /*!< 12 Cortex-Mx Debug Monitor Interrupt */
PendSV_IRQn = -2, /*!< 14 Cortex-Mx Pend SV Interrupt */
SysTick_IRQn = -1, /*!< 15 Cortex-Mx System Tick Interrupt */
/****** CMSDK Specific Interrupt Numbers *******************************************************/
WDT_IRQn = 0,
UNKNOWN0_IRQn = 1,
UNKNOWN1_IRQn = 2,
UNKNOWN2_IRQn = 3,
UART0_IRQn = 4,
UNKNOWN3_IRQn = 5,
UNKNOWN4_IRQn = 6,
UNKNOWN5_IRQn = 7,
TIMER0_IRQn = 8,
TIMER1_IRQn = 9,
DUALTIMER0_IRQn = 10,
UNKNOWN9_IRQn = 11,
UNKNOWN10_IRQn = 12,
UNKNOWN11_IRQn = 13,
UNKNOWN12_IRQn = 14,
......... 중략 ............
UNKNOWN237_IRQn = 239
} IRQn_Type;
startup_xxx.s
Stack_Size EQU 0x0000800
......... 중략 ............
PRESERVE8
THUMB
; Vector Table Mapped to Address 0 at Reset
AREA RESET, DATA, READONLY
EXPORT __Vectors
EXPORT __Vectors_End
EXPORT __Vectors_Size
__Vectors DCD __initial_sp ; Top of Stack
DCD Reset_Handler ; Reset Handler
DCD NMI_Handler ; NMI Handler
DCD HardFault_Handler ; Hard Fault Handler
DCD MemManage_Handler ; MPU Fault Handler
DCD BusFault_Handler ; Bus Fault Handler
DCD UsageFault_Handler ; Usage Fault Handler
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD SVC_Handler ; SVCall Handler
DCD DebugMon_Handler ; Debug Monitor Handler
DCD 0 ; Reserved
DCD PendSV_Handler ; PendSV Handler
DCD SysTick_Handler ; SysTick Handler
; External Interrupts
DCD WDT_IRQHandler ;
DCD UNKNOWN0_IRQHandler ;
DCD UNKNOWN1_IRQHandler ;
DCD UNKNOWN2_IRQHandler ;
DCD UART0_IRQHandler
DCD UNKNOWN3_IRQHandler ;
DCD UNKNOWN4_IRQHandler ;
DCD UNKNOWN5_IRQHandler ;
DCD TIMER0_IRQHandler ;
DCD TIMER1_IRQHandler ;
DCD DUALTIMER0_Handler ;
DCD UNKNOWN9_IRQHandler ;
DCD UNKNOWN10_IRQHandler ;
DCD UNKNOWN11_IRQHandler ;
DCD UNKNOWN12_IRQHandler ;
DCD UNKNOWN13_IRQHandler ;
DCD UNKNOWN14_IRQHandler ;
........ 중략 ............
DCD UNKNOWN237_IRQHandler
........ 중략 ............
Default_Handler PROC
EXPORT WDT_IRQHandler [WEAK]
EXPORT UNKNOWN0_IRQHandler [WEAK]
EXPORT UNKNOWN1_IRQHandler [WEAK]
EXPORT UNKNOWN2_IRQHandler [WEAK]
EXPORT UART0_IRQHandler [WEAK]
EXPORT UNKNOWN3_IRQHandler [WEAK]
EXPORT UNKNOWN4_IRQHandler [WEAK]
EXPORT UNKNOWN5_IRQHandler [WEAK]
EXPORT TIMER0_IRQHandler [WEAK]
EXPORT TIMER1_IRQHandler [WEAK]
EXPORT DUALTIMER0_Handler [WEAK]
EXPORT UNKNOWN9_IRQHandler [WEAK]
EXPORT UNKNOWN10_IRQHandler [WEAK]
EXPORT UNKNOWN11_IRQHandler [WEAK]
EXPORT UNKNOWN12_IRQHandler [WEAK]
EXPORT UNKNOWN13_IRQHandler [WEAK]
EXPORT UNKNOWN14_IRQHandler [WEAK]
......... 중략 ............
EXPORT UNKNOWN237_IRQHandler [WEAK]
......... 중략 ............
WDT_IRQHandler
UNKNOWN0_IRQHandler
UNKNOWN1_IRQHandler
UNKNOWN2_IRQHandler
UART0_IRQHandler
UNKNOWN3_IRQHandler
UNKNOWN4_IRQHandler
UNKNOWN5_IRQHandler
TIMER0_IRQHandler
TIMER1_IRQHandler
DUALTIMER0_Handler
UNKNOWN9_IRQHandler
UNKNOWN10_IRQHandler
UNKNOWN11_IRQHandler
UNKNOWN12_IRQHandler
UNKNOWN13_IRQHandler
UNKNOWN14_IRQHandler
......... 중략 ............
UNKNOWN237_IRQHandler
BX LR
ENDP
ALIGN
ENDIF
END
'초보의 아웅다웅 설계하기 > STM32' 카테고리의 다른 글
STM32L496 Unique ID 확인하기 (0) | 2020.05.21 |
---|---|
SW6STM에서 고정위치에 바이너리 라이팅하기 (0) | 2020.05.20 |
STM32L432 Write Protection (0) | 2020.03.04 |
STM32 PID 제어 (0) | 2020.01.16 |
STM32H750 ReadProtection, BrownOutReset 설정 (0) | 2020.01.08 |