2019-04-26 06:50 AM
Hardware & HAL:
Tested:
Result:
My Conclusion:
Question:
Attachment:
Hint: 2xUART IRQ below is send of new 64 byte buffer because TXE IRQ is immediate empty after byte moved to shift out register in UART
2019-04-30 08:32 AM
Solved:
The CPU is not really processing at core speed because of 5 DMA slots (CPU,DMA1,DMA2,USB,ETHER)
So only 210MHz /5 is available for CPU slot if not the complete ISR is inside instruction cache.. and pop could not happen because stack is not inside I-Cache
I checked by logic analyzer and it also matches with calculation if you single step your ISR . estimate the ISR cycles by 2 for each single step and multiply with 5/210MHz.. voila nearly the same as in logic analyzer
If you want the exactly cycle time you can enable at cortex M 7 cycle count register
void UART5_IRQHandler(void)
{
/* USER CODE BEGIN UART5_IRQn 0 */
+ volatile unsigned int *DWT_CYCCNT = (volatile unsigned int *)0xE0001004;
+ COUNT1 = *DWT_CYCCNT;
#if !defined(LED_LOGIC_ANALYZER)
HAL_GPIO_TogglePin(GPIOG, GPIO_PIN_10); //green LED used UART IRQ
#else
@@ -262,7 +261,7 @@ void UART5_IRQHandler(void)
iIRQ_UART5++;
#endif
-
+ COUNT2 = *DWT_CYCCNT;^M
/* USER CODE END UART5_IRQn 1 */
}
and print it out in you lowest IRQ routine to get NVIC worst case by RTOS in polling UART mode =)
iRX_DMAcounter: 31 iRX_DMAcounterNow/s: 2 iRX_DMAcounterMax/s: 3
iIRQ_UART5: 3061 iIRQ_UART5Now/s: 171 iIRQ_UART5Max/s: 190
iCDCBlockRequest: 340 iCDCBlockRequestNow/s: 9 iCDCBlockRequestMax/s: 10
iSeconds: 47
CYCLES: 1545
CYCLES min: 752 => 3.58 us
CYCLES max: 1566 => 7.46 us
CDCReceive: 350 CDCReceiveNow/s: 10 CDCReceiveMax/s: 10
iRX_DMAcounter: 34 iRX_DMAcounterNow/s: 3 iRX_DMAcounterMax/s: 3
iIRQ_UART5: 3251 iIRQ_UART5Now/s: 190 iIRQ_UART5Max/s: 190
iCDCBlockRequest: 350 iCDCBlockRequestNow/s: 10 iCDCBlockRequestMax/s: 10
iSeconds: 48
CYCLES: 1543
CYCLES min: 752 => 3.58 us
CYCLES max: 1566 => 7.46 us
CDCReceive: 359 CDCReceiveNow/s: 9 CDCReceiveMax/s: 10
iRX_DMAcounter: 36 iRX_DMAcounterNow/s: 2 iRX_DMAcounterMax/s: 3
iIRQ_UART5: 3422 iIRQ_UART5Now/s: 171 iIRQ_UART5Max/s: 190
iCDCBlockRequest: 359 iCDCBlockRequestNow/s: 9 iCDCBlockRequestMax/s: 10
iSeconds: 49
CYCLES: 1447
CYCLES min: 752 => 3.58 us
CYCLES max: 1566 => 7.46 us
at after some seconds you get your NVIC event from e.g in this case its OS Tick with high paket load in full duplex at 115200 (brigded RX & TX load only and not 100% async)
CReceive: 100527 CDCReceiveNow/s: 181 CDCReceiveMax/s: 182
iRX_DMAcounter: 100124 iRX_DMAcounterNow/s: 182 iRX_DMAcounterMax/s: 182
iIRQ_UART5: 6690741 iIRQ_UART5Now/s: 12132 iIRQ_UART5Max/s: 12145
iCDCBlockRequest: 100530 iCDCBlockRequestNow/s: 181 iCDCBlockRequestMax/s: 182
iSeconds: 738
CYCLES: 657
CYCLES min: 452 => 2.15 us
CYCLES max: 2193 => 10.44 us
next step is to count the cycles intelligent by USB IRQ al lowest prio) NVICed by worst case.. result we lost a byte because we are too slow (below 86us) for IRQ handling service :face_with_tears_of_joy: ..and /dev/ttyACM0 1,2,3,4 torture test aknowled by error :face_with_tears_of_joy:
2019-04-30 09:41 AM
>I think Interrupt takes 12 cycles max to enter, then same to exit, if not using float within interrupts.
Correct answer.. But HAL is not as bad as expected.. maybe HAL about 18 in best case..with out my debug pin and counter stuff.. in some case I have to care also about IDLE and DMA ring buffer
.. also depends on the amount of the flags and if NVIC happens to your UART
see my answer at the end of the post (solved)
5 DMA explain why we do nat have real 210MHz for ISR ..that was the stuff I want to understand.
We only have about 40MHz in real for processing ISRs :confounded_face:
2019-04-30 09:46 AM
IN the picture you can see dual load of emty UART TXE (2x). becaue its a NVIC of the USB you can see a pop and push time :beaming_face_with_smiling_eyes: at fake 210MHz because of fixed DMA channels