Getting HardFault Exception and Bus Errors on Dumping Code to Controller

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello All,

 

I have installed IAR Embedded Workbench IDE and tried to dump the code to the controller but it is giving me various error related to Stack, Program Counter, HardFault Exception, Bus Fault etc.

 

I am getting Hardfault exception error when trying to dump the code to controller with the help of ATMEL ICE  debugger. 

 

The few error lines from the file are:- 

 

 HardFault exception. 
 

The processor has escalated a configurable-priority exception to HardFault. 

  A bus fault has occurred on an instruction prefetch (CFSR.IBUSERR, BFAR). 

  The processor has attempted to execute an undefined instruction (CFSR.UNDEFINSTR). 

Exception occurred at PC = 0x7f4, LR = 0xffffffff 

 

You can observe the above errors in the file attached also which is observed during the dumping of code to controller in the IAR IDE. Please, suggest how to solve this errors.

 

Thanks.

 

 

Attachment(s): 

Last Edited: Tue. Sep 3, 2019 - 09:28 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

'dumping' means to read the code from the controller, not write it. So please be a bit more precise with your problem description. We don't even know what the processor is!

 

You might want to run the problem past IAR - it's a premium product, so try out their support.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The controller is ATSAME54P20A, mentioned it in the tag but forget to mention it in the description. Thanks for your advice KArtman, I will try out IAR support, but just posted my problem here to get quick reply if someone had this issues earlier. 

Can you google it , how dumping is "reading" from the controller and not write to it ?? I think it is writing some data to the microcontroller. 

 

Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello All, 

 

If anyone have faced the above issues earlier then please help. 

 

Thanks in advance.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The term 'dump' goes back into history with the 'core dump' with 'core' meaning core memory which was the technology of the day nd when the operating system crashed, it would 'dump' the core on the printer (usually). So you can call it what you like, but others need to understand what you're asking. Your listing makes no mention of 'dumping'.

 

If you want some help to solve your problem, then give us a bit more information! There could be millions of reasons why you're having the problem. We have no clue as to what your hardware is, what your code is, how you created the project or a copy of the smallest example that exhibits your problem. It could be that you have not selected the appropriate run time module or your hardware is suspect. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello @Kartman, 

 

We have made a custom PCB with the ATSAME54P20A controller embedded into it. In the current scenario, the simple LEDFlasher code taken from the Atmel Start Page, the link for the same is as shown below is not working in our custom board :- 

 

https://start.atmel.com/#example...

 

In our custom PCB, we have currently soldered 32.768KHz oscillator, LDO's for DC power input, and 3.3V DC constant supply. Also various decoupling capacitors and zener protection is provided to protect the microcontroller from the power surge. We are able to read correct device ID and voltage for the microcontroller when seen from the Atmel Studio 7, Tools -> Device Programming menu.   

 

We are using the ATMEL ICE debugger to dump the code to the controller. So, when we try to dump the code, by setting breakpoint in ResetHandler() function, the code reaches here and the controller goes into free running state.But when we break the execution of the program it gives us "Memory out of bound error" while sometimes it goes into Dummy_Handler() function. Attached below are the images for the same.

 

We have tested our board with both IDE's i.e Atmel Studio 7 and IAR Embedded Workbench but the issue remains the same. 

 

I hope everything is clear. Please, do comment if you need some more information. 

Thanks in advance. 

 

 

Attachment(s): 

Last Edited: Wed. Sep 4, 2019 - 12:32 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does the code work in Atmel Studio? Is the code being loaded in the correct addresses?
Is there a command or process labelled ‘dump’ on the IDE? There isn't because it is the wrong term for the wrong action. Don’t make up terms. Use the actual terms that the IDE uses.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The code is working perfectly when checked with  Atmel Xplained PRO development kit in Atmel Studio 7 but it is not working with our custom PCB. Ok, lets not use the term Dump and fight over it, let's  keep it simple as write some data to controller (short and simple). 

 

I don't know how to solve this errors related to hardfault exception and bus errors. Can you help me on this ?? 

Last Edited: Wed. Sep 4, 2019 - 12:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You’ve mentioned a fewcombinations here:
Iar
Atmel studio 7
Xplained board
Your hardware

What works where? You need to try to narrow down the possibilities - is it code or hardware? A common problem is the demo code expects the crystals on the xplained board. If your hardware doesn’t have this, then you get some form of exception when the clock doesn’t work. If this is the case you need to understand the clock settings and modify them.
Different chips might have different ram - this affects the placement of the stack. If you try to access non-existent memory, then you get a bus fault.

Last Edited: Wed. Sep 4, 2019 - 01:14 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
You need to try to narrow down the possibilities - is it code or hardware?

HARDWARE.

 

I'd say its their custom board as:

shivasworld wrote:
The code is working perfectly when checked with  Atmel Xplained PRO development kit in Atmel Studio 7 but it is not working with our custom PCB.

 

Maybe they need to dump the custom board and find another?

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user