dhruvacharya wrote on Friday, October 02, 2015:
Hi @Hein,
After your suggestion I have tested with this:
You install a DMA interrupt:
GLCD_DMA_INT_StartEx(vGLCD_DMA_ISR);
before the tasks are created.
This is done. I have called this after the Task Created.
GLCD_DMA_INT_StartEx(vGLCD_DMA_ISR);
GLCDPWM_1_Start();
GLCDPWM_2_Start();
GLCD_UPDATE_Write(0);
A note about masking interrupts:
CY_ISR(vGLCD_DMA_ISR)
{
...
/* Mask off the other RTOS interrupts to interact with the queue. */
- ulMask = portSET_INTERRUPT_MASK_FROM_ISR();
...
- portCLEAR_INTERRUPT_MASK_FROM_ISR( ulMask );
I wonder if the masking is really necessary? Could you leave-out the SET/CLEAR couple and test it?
This is also done. Commented SET-CLEAR Couple
When you declare data which will never change, use the word “const”:
- char text2[] = "Galaxy Electronics\0";
+ const char text2[] = "Galaxy Electronics";
The addition of “\0” in a string is not necessary, the compiler already does that for you.
This is also done.
-uint8 CYXDATA u8GLCDPages[24] =
+const uint8 CYXDATA u8GLCDPages[24] =
{
0x3F, // Turn on the display at 0, rest can be any (0x00)
0xB8, //SET_PAGE 0
0x40, //SET_ADDRES 0
...
When declared as “const”, this data doesn’t occupy any space in RAM.
I tried this, but didn’t worked because I think u8GLCDPages is used in the some definition of the TDs of DMA, and it only accept the RAM location. So changed back to original and application is working again with hard fault occured.
But I think with KIT I was using the same code before your comments and application is running, and in Hardware it goes to Hard Fault Handler. I cann’t understand why this is so?
Now for the stack comments:
In FreeRTOSConfig.h:
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0
#define configMAX_PRIORITIES ( 6 )
#define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( ( unsigned long ) BCLK__BUS_CLK__HZ )
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 100 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 32 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 25 )
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 0
#define configUSE_CO_ROUTINES 0
#define configUSE_MUTEXES 1
And in TaskStack.h
#define vMonitor_Task_Stack ( 5 * configMINIMAL_STACK_SIZE )
#define vGLCD_Task_Stack ( 10 * configMINIMAL_STACK_SIZE )
#define vGLCD_GEMain_Task_Stack ( 5 * configMINIMAL_STACK_SIZE )
But again same problem of going into hard fault handler, just the contains of the register from prvGetRegistersFromStack chaged. Thanks again.