你好,
我正在使用STM8L151使用IAR工作台而没有ST固件库,我正在尝试使用SPI中断。不幸的是它不起作用。
SPI已经运行,接收标志已设置,但我没有得到中断:
这是配置:
SYSCFG_RMPCR1 = 0×00; // MIS0-> PB7,MOSI-> PB6,SCK-> PB5,NSS-> PB4
CLK_PCKENR1 = 0x10的; //启用SPI时钟
SPI1_CR1 =的0x30; //启用SPI,Baurate
SPI1_CR1_CPOL = 0;
SPI1_CR1_CPHA = 1;
SPI1_CR1_LSBFIRST = 0;
SPI1_CR2_SSM = 1;
SPI1_CR2_SSI = 1;
SPI1_CR1_MSTR = 1;
SPI1_CR1_SPE = 1;
SPI1_ICR_RXIE = 1;启用SPI中断
和中断向量:
& sharppragma vector = SPI_RXNE_vector
__interrupt __root void SPI(void)
{
int a = 0;
}
我是否必须在全球范围内启用任何类型的中断?
#spi #stm8l #interrupts
以上来自于谷歌翻译
以下为原文
Hello,
I'm using the STM8L151 using IAR workbench without ST Firmware Library and I'm trying to use an SPI Interrupt. Unfortunatey it doesn't work.
SPI is already running, the receiving flag is set, but i don't get an Interrupt:
This is the configura
tion:
SYSCFG_RMPCR1=0x00; //MIS0->PB7, MOSI->PB6, SCK->PB5, NSS->PB4
CLK_PCKENR1=0x10; //enable SPI clock
SPI1_CR1=0x30; //enable SPI, Baurate
SPI1_CR1_CPOL=0;
SPI1_CR1_CPHA=1;
SPI1_CR1_LSBFIRST=0;
SPI1_CR2_SSM=1;
SPI1_CR2_SSI=1;
SPI1_CR1_MSTR=1;
SPI1_CR1_SPE=1;
SPI1_ICR_RXIE=1; Enable SPI Interrupt
And the Interrupt vector:
&sharppragma vector=SPI_RXNE_vector
__interrupt __root void SPI(void)
{
int a=0;
}
Do i have to enable the Interrupts globally in any Kind?
#spi #stm8l #interrupts