AVR32 troubleshooting
In this section, I will describe different problems I ran into. Everytime I spend a lot of time trying to figure why something did not work, I will post the found solutions here.
Illegal opcode with conditional instructions
Everytime I was using "addhi" I got an illegal opcode exception. The worse thing was that I was using addhi inside and exception handler. This is because it seems that my CPU uses architecture revision 1. when looking at the isntruction set reference, you can see that these instructions are meant to be used on revision 2 architecture. It is a shame because I couldn't wait to use those.... oh well.
Unrecoverable exception on scall
Everytime I was using "scall", the "unrecoverable exception" was issued instead of EVBA+0x100. I found out that this is because EVBA was not alligned on a 8kb oundary
Copying to parallel flash using u-boot
The address ranges in the AT49BV642D datasheet are 16bit words! So when they say that the sector 23 resides from 0x80000 up to 0x87FFF, it really means from 0x100000 to 0x107FFF.
ASID field in page table
I could understand from the architecture document that the ASID field in a page table entry (from the TLB) is used by the MMU to match the current process ID. What I could not understand was that the ASID field is matched... against what? Yes it is matched against the processID but where is the current proces ID stored? It is in the TLBEHI register. so the TLBEHI[ASID] field should not only be filled before loading a page in the TLB, it should be loaded ALL the time since it will be used for the comparison as well.
Locking entries in TLB
When setting DLA or ILA in MMUCR, make sure you change DRP or IRP accordingly. If you lock the first entry and leave DRP (or IRP) to 0, you will never be able to write anything in the TLB
INTC not working properly, values written to IPR are read back as zero
Make sure that INTC is enabled in PBBMASK (See power manager)
Comparing a page with buffer on the dataflash always says that the page matches even though it is different
When I was reading a page (using 0x87) , then writting something else to buffer1. A buffer comparison always returned that the pages matched. To fix this, I am now using buffer2 to write and compare. It solves the problem but it doesn't make any sense.
MACB: RBQP increases when receiving frames but descriptor's ownership flag does not change
It is important to load RBQP with a physical address (not virtual address). Descriptors must also be loaded with physical addresses. Also, even if reading descriptors from the P2 segment (uncached memory), it is important to invalidate the cache ("cache r0[0],0b1011").