|
|||||||||||
Technical Support Support Resources
Product Information |
µVISION DEBUGGER: No ISPI Flag While Working With SPIInformation in this article applies to:
QUESTIONI'm using the SPI on the ADuC812, and what I've noted is that when I write a character to SPIDAT SFR, I never get the ISPI interrupt flag set in both SPI window and Interrupt System window when debugging, but the interrupt is vectored and executed. Is it a problem with the simulator? Here's my test code.: #include <aduc812.h> #include <intrins.h> static unsigned char number_of_ints; void spi_data_send ( unsigned char character ) { SPIDAT= character; // MOV SPIDAT,#XXX } void SPI_int ( void ) interrupt 7 { number_of_ints++; _nop_(); } void main ( void ) { unsigned char i; SPICON = 0x34; // FOSC/4 Master mode SPI enabled IE2 |=0x01; // Enable SPI interrupt EA = 1; for ( i=0; i<=10; i++ ) spi_data_send(i); while(1); } ANSWERIt's not actually a problem. The interrupt bit is not set, but the interrupt routine is executed. It happens because the interrupt was programmed with auto-reset on interrupt entry described in the errata sheet. In the example, the SPI interrupt is set immediately after the MOV SPIDAT,#XXX instruction which causes the PC to vector to the interrupt routine which then automatically clears the interrupt bit. The interrupt bit is set only for 2 cycles which are needed to fetch the interrupt vector. But since the instruction simulator simulates this fetch together with the previous instruction, you can't see the interrupt getting set and cleared but the interrupt routine is executed. Everything works as it should. To test if the interrupt bit is being set, simply disable this interrupt and the interrupt request bit will be set after the MOV SPIDAT,#XXX instruction. The auto-reset feature isn't described in the data sheet but in an errata sheet. Last Reviewed: Tuesday, February 23, 2021 | ||||||||||
|
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.