Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

FIFO vs Interrupts vs Paged Memory MAP

Status
Not open for further replies.

Bukitoo

Full Member level 2
Full Member level 2
Joined
Oct 12, 2003
Messages
122
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,298
Location
Argentina
Activity points
1,061
Hi!
I´ve recently started to work in a Company to fix "some software problems" of a Embedded System (that i didn't design).
Actually, there weren't some. It is a system with 512 kb using a atmega128 (it can manage only 64kb, so it uses 8 pags of memory).
Also, the system has implementations of queues using those pages. Of course there are interrupts in parallel making mess.
After some months of hard work, I fix some bugs, buy the bigger one it is a deep secret to me. I tried to force those errors, but they apear in some unique conditions tha I can´t reproduce. Aparently some pointer of some data structure it's changing its value and ovelaping addresses, but this is a suposition. Maybe the stack is reach overflow. I don't know.

Maybe someone could help me giving me some advice. Some book to refer, or something !!! Pleease!

Thanks in advance
 

You've inherited someone's buggy project. Lucky you.

Does the failure occur on your bench, or is it one of those bugs that only happens when the customer touches it?

If the failure causes some immediate symptom, then try using a logic analyzer to watch the CPU bus. Program it to stop when it sees the failure symptom. Now you have a snapshot of the CPU behavior prior to failure.

Another approach is to insert debugging code at strategic places in the firmware. If it detects something suspicious, it immediately goes into safe mode (disable interrupts, new stack pointer, whatever), and dumps the CPU registers and memory contents through a simple I/O port to an external computer. Now you can dig through that stuff for more clues.
 

With paging enabled, it is always to difficult to handle the paged data always.

the best way can be selecting HUGE memory model, where all data is assumed to be paged. I am not sure this will solve the problem.

When i was working with this type of arch with C167, I faced same problems when i used pointers to this memory as members of other structures. For normal data objects placed place with FAR keywords it worked fine.

Any how I was doing coding and had the liberty of changing the code as I want to make compiler happy.

best of luck
idlebrain
 

Thanks for the Replies!
echo47: The problem is that the system has 2 boards with 2 uControllers. THey communicate through SPI bus, but their functionality are totally asinchonous.

I know ther are many problems. The problems ocurr very frequently on the field, and VERY unfrequently on my bench.

Unfortunally the Documentation doesn´t exist. :cry:

Both of uC has dump reports when errors ocurr, but now a days tha information they give is useless.

idlebrain: Thank you for your advice. I know that the compiler (IAR AVR WORKBENCH) has those compiler directives so I´m going to read carfully their functionallity.
 

Bukitoo said:
Hi!
Aparently some pointer of some data structure it's changing its value and ovelaping addresses, but this is a suposition. Maybe the stack is reach overflow. I don't know.

Maybe someone could help me giving me some advice. Some book to refer, or something !!! Pleease!

Thanks in advance

Stack overflow is hard to find. That's a good reason to prefer an embedded os.
Maybe you can simulate a stack-check function. Replace all calls in your code with a call macro and check the stack before you make a call.

A other reason for your problems can be that your bank switching and bank addressing is interupted by a interrupt routine and same register are not right saved and/or restored. You can try to disable your interrupts global before you address your next page and enable after.

Gomez
 

A other way to find stack overflow is to fill up your stack with a special byte (0xAA) before you jump to main. After a crash you can read back your stack and check that the top on your stack is 0xAA.


Gomez
 

    Bukitoo

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top