sabra88
Newbie level 2
Hello everybody,
I have interfaced a master board with a slave board and i am sending a buffer from the master and reading it on the slave using RX interrupt handler (internal interrupts) to pass the data from SPI to the task.
The problem is that the interrupt is excuted only one time and then it is blocked but i need to excute the interrupt as many times as the received characters and after receiving the whole packet, i send it into a queue to the task.
I work under EFM32 mcu.
What am I missing??
I have interfaced a master board with a slave board and i am sending a buffer from the master and reading it on the slave using RX interrupt handler (internal interrupts) to pass the data from SPI to the task.
The problem is that the interrupt is excuted only one time and then it is blocked but i need to excute the interrupt as many times as the received characters and after receiving the whole packet, i send it into a queue to the task.
I work under EFM32 mcu.
What am I missing??
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 /**************************************************************************//** * USART2 RX IRQ Handler *****************************************************************************/ void USART2_RX_IRQHandler(void) { USART_IntClear(USART2, USART_IF_RXFULL); if (USART2->STATUS & USART_STATUS_RXFULL) { /* Reading out data */ rxdata = USART2->RXDOUBLE; if (slaveRxBufferIndex < slaveRxBufferSize) { /* Store Data */ slaveRxBuffer[slaveRxBufferIndex] = rxdata; slaveRxBufferIndex++; } } if(slaveRxBufferIndex == slaveRxBufferSize) { slaveRxBufferIndex=0; receive_irq_handler(); } } /**************************************************************************//** * software interrupt which sends data to the queue after receiving the whole packet *****************************************************************************/ void receive_irq_handler(void) { portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; T_Concentrator_CMD.FromModule = Module_IRQ; T_Concentrator_CMD.ID_Service = slaveRxBuffer[0]>>8; //take the most significant bits of the first word T_Concentrator_CMD.ID_trame = slaveRxBuffer[0]; T_Concentrator_CMD.Nb_Data = slaveRxBuffer[1]>>8; T_Concentrator_CMD.ID_Device = slaveRxBuffer[1]; data_length = (T_Concentrator_CMD.Nb_Data)*2; memcpy(T_Concentrator_CMD.Payload,slaveRxBuffer+0x02 ,data_length); status=xQueueSendFromISR(xQueueConcentratorTask, &T_Concentrator_CMD,0 ); if(status == pdPASS) { #ifdef DEBUG_FREE_RTOS vPrintf( "ISR successfully send data to Concentrator task\n" ); #endif } else { #ifdef DEBUG_FREE_RTOS vPrintf(" Request Could not be sent to xQueueConcentratorTask\n" ); #endif } portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); }
Last edited by a moderator: