Before I start, let me say that I'm brand new to Freescale, Eclipse, and the Freedom board.
I thought the board and tool chain would give me an opportunity to learn something new about the Freescale hardware and Eclipse/CodeWarrior IDE. I have to say that after about a week of spending my free time coming up the learning curve, I'm really disappointed on multiple fronts. I have found the documentation about as unhelpful as any I've encountered, and I've been doing this since 1980. But maybe I'm just not used to the Freescale way of thinking.
The example applications are good starting points, but when I wade out into deeper water I get into trouble. For instance, you have to dig pretty deep to find out that you can write in C++, or you can use Processor Expert, but not both. Yes, I went through the tutorial on how to manually change the compiler setup to accommodate both, but it left me with several additional compiler errors that I couldn't figure out. And there are severe limits on what the Processor Expert components can do, but I haven't been able to find a good description of P.E. capabilities, so I'm forced to add a component, wade through the configuration, and then find out it won't work for what I need to do.
My demo application is to add a readily available 320x240 LCD display to the Freedom, using FreeRTOS. Once the display is working, I'll add other application code. This particular display uses a 16 bit parallel data interface (one of the things I can't get P.E. to do) and 5 single bit signals to drive the control lines.I have port B assigned to drive the control lines, and the P.E. code for these single bits seems to work properly. But I can't get port C configured to drive the data lines. My configuration code uses the global pin control registers as follows:
#include "IO_Map.h" // cfg lower 14 bits of PORTC (data bus) as I/O, no pull up/dn, no intr, no slew limit, hi drive strength | |
PORTC_GPCLR = (0x3fff << 16) | (PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK); // =0x3FFF 0105 | |
// cfg bits 16,17 of PORTC (data bus) as I/O, no pull up/dn, no intr, no slew limit, hi drive strength | |
PORTC_GPCHR = (0x0003 << 16) | (PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK); // =0x0003 0105 | |
// config PORTC bits 0-13, 16, 17 as outputs | |
GPIOC_PDDR |= GPIO_PDDR_PDD(0x00033fff); | |
// set outputs high | |
GPIOC_PDOR = 0x00033FFF; |
When I execute the first line (PORTC_GPCLR = ...), I get an immediate trap to the Hard Fault interrupt. I can't find what this means. The 807 page KL25 reference manual lists Hard Fault exactly once, and I can't find useful info on how to set this port up.
Can anyone tell me why this code generates a hard fault, or how to properly configure this port? Any help is genuinely appreciated!