element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Freedom development platform
  • Products
  • Dev Tools
  • Freedom development platform
  • More
  • Cancel
Freedom development platform
Forum Get exception trying to configure port C I/O
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Freedom development platform to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 3 replies
  • Subscribers 7 subscribers
  • Views 609 views
  • Users 0 members are here
  • hard_fault
  • processor_expert
  • lcd_display
  • freescale_freedom
  • gpio_configuration
  • freertos
Related

Get exception trying to configure port C I/O

rayz55
rayz55 over 12 years ago

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!

  • Sign in to reply
  • Cancel
Parents
  • rayz55
    rayz55 over 12 years ago

    Followup:

    After more digging, I found that the BitsIO_LDD P.E. component (as opposed to the BitsIO component) will allow multi-bit configurations up to 32 bits. So I decided to use it instead of the 'raw' port manipulation in the original post. Unfortunately, the Component Inspector would not allow me to assign bits 0-13 plus bits 15 and 16. So I created a component for bits 0-13, then modified the h and c files to include the other bits, and marked the files read-only so they wouldn't get overwritten. This seems to work well. So now the LCD library is still not working correctly but at least I have the pins being driven correctly. Back to debugging...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • JohnDSiviter
    JohnDSiviter over 12 years ago in reply to rayz55

    Raymond, did you mange to resolve the problems with the LCD library?, if you are still struggling please email me: jsiviter@farnell.com

    I will post a summary once we have identified the problem.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • JohnDSiviter
    JohnDSiviter over 12 years ago in reply to rayz55

    Raymond, did you mange to resolve the problems with the LCD library?, if you are still struggling please email me: jsiviter@farnell.com

    I will post a summary once we have identified the problem.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • rayz55
    rayz55 over 12 years ago in reply to JohnDSiviter

    @John, yes I have the problems resolved and the port of UTFT LCD library is working well. The performance is quite good, even without extensive optimizations. I have not had time to implement the touchscreen code yet. I have not been able to get Processor Expert, FreeRTOS, and C++ to co-exist. But otherwise the project is coming along nicely. Thanks,

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube