Hi Ramsey,
I tried Hwi_disable when entering the SWI and Hwi_enable on the way out but the problem persist (again, it worsen when I add the pending on notify semaphore). So I guess that the Hwi isn't the problem (or is it...).
The data rate is Set by the sensor and it is constant. Here is how I handle the SPI:
// First HWI void GPIOBank2Isr(void) { /* Clears the system interrupt status of GPIO in AINTC.*/ IntSystemStatusClear(SYS_INT_GPIOB2); if(GPIOPinIntStatus(SOC_GPIO_0_REGS, SENS0_VD_PIN) == GPIO_INT_PEND) { /* Clears the Interrupt Status of the correct pin in GPIO.*/ GPIOPinIntClear(SOC_GPIO_0_REGS, SENS0_VD_PIN); if(isAvail0) { Swi_post(swi0); } } } // Second HWI void GPIOBank0Isr(void) { /* Clears the system interrupt status of GPIO in AINTC.*/ IntSystemStatusClear(SYS_INT_GPIOB0); if(GPIOPinIntStatus(SOC_GPIO_0_REGS, SENS1_VD_PIN) == GPIO_INT_PEND) { /* Clears the Interrupt Status of the correct pin in GPIO.*/ GPIOPinIntClear(SOC_GPIO_0_REGS, SENS1_VD_PIN); if(isAvail1) { Swi_post(swi1); } } } // First SWI (swi0) ISR Void Read0(Void) { Hwi_disable(); short *buff = (short*)CalRxBuffA; int current = idxA % totalLength; readA = length; SPIDat1Config(SENS0_SPI_REGS, (SPI_CSHOLD |SPI_DATA_FORMAT0), (1<<SENS0_CS)); SPIReceiveData(SENS0_SPI_REGS, length, &buff[current], &readA, &idxA); SPIDat1Config(SENS0_SPI_REGS, (SPI_DATA_FORMAT0), (1<<SENS0_CS)); Hwi_enable(); } // Second SWI (swi1) ISR Void Read1(Void) { Hwi_disable(); short *buff = (short*)CalRxBuffB; int current = idxB % totalLength; readB = length; SPIDat1Config(SENS1_SPI_REGS, (SPI_CSHOLD | SPI_DATA_FORMAT0), (1<<SENS1_CS)); SPIReceiveData(SENS1_SPI_REGS, length, &buff[current], &readB, &idxB); SPIDat1Config(SENS1_SPI_REGS, (SPI_DATA_FORMAT0), (1<<SENS1_CS)); Hwi_enable(); } /* ** Get Data from SPI slave ** */ void SPIReceiveData(unsigned int baseAdd, unsigned short length, short *buffer, UInt8 *read, UInt64 *idx) { int i; for(i=0;i<length;i++) { while(!(HWREG(baseAdd + SPI_SPIFLG) & SPI_SPIFLG_TXINTFLG)); SPITransmitData1(baseAdd, 0); while(!(HWREG(baseAdd + SPI_SPIFLG) & SPI_SPIFLG_RXINTFLG)); *buffer = (short)SPIDataReceive(baseAdd); buffer++; (*read)--; (*idx)++; } }
How can we notify a SYS\BIOS expert on this matter?
Thanks for the help!
Yoel