SAM7X debug unit TX/RX

Hi! In the SAM7X controller there is one UART available under debug unit. But it shares the same interrupt as periodic timer which is used for FreeRTOS scheduler. In case I would like to use interrupt driven communication via that debug unit (utilise it as normal uart in my project), I have to modify portISR.c to check if its communication interrupt or scheduler tick. Has anybody done it? Maybe it would be good idea to add some kind of #define to the FreeRTOSConfig.h for SAM7X to specify whether to use debug unit uart or not? Any other ideas? BR, Madis

SAM7X debug unit TX/RX

You’re on the right path. In portISR you have to check from which peripheral the interrupt is coming and handle it. Here is how I do it: if ((AT91C_BASE_PITC->PITC_PISR & AT91C_PITC_PITS) > 0) {     vTaskIncrementTick(); } else if ((((AT91PS_USART)AT91C_BASE_DBGU)->US_CSR & AT91C_US_RXRDY) > 0) {     vUsartDebugISR(); } vUsartDebugISR() is an inline function (like vTaskIncrementTick()) that does only puts received data on a queue. I don’t know if it’s still the case but when I tried it the first time with a normal function call it didn’t work. I’m not sure where I found this handling. Either in some previous version of FreeRTOS or somewhere here in the forum. But it is also possible to change the tick timer from PIT to one of the TCs and handle the system interrupt as every other interrupt but I haven’t tried that yet.

SAM7X debug unit TX/RX

Hello madis and saiberion I use too the DBGU unit for debugging purpose on a serial com. I use it to send messages on a com to show various errors in the processing flow. I use the Saiberion method which share the PIT interrupt for the kernel tick and the DBGU interface. It doesn’t seem to make difficulties on the com processing, but I don’t use it for an application communication interface. By the way, this com has limitation and you will be stuck to an 8 bytes with parity format. The baud rate generator is also more simple, and there is no more rs485, irda, iso7816 mode. As for the FreeRTOSconfig.h, this DBGU is quite specific for atsam7x. Is it a good idea to insert quite a specific purpose on a more general project like FreeRTOS ? Perhaps a good application example should be enough.