Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

Read physical address

Altera_Forum
Honored Contributor II
1,148 Views

Hello, 

 

I'm trying to read address 0x0400000 (start address of avalon interface 32bits read) and the NIOS just stopped working, I can't read the entire memory block (0x0400000 - 0x040ffff or so) but i can read from other memory blocks, 

 

I wonder if anyone encountered this problem ?
0 Kudos
10 Replies
Altera_Forum
Honored Contributor II
459 Views

What device is connected to that address range? 

Probably the device is keeping the waitrequest line asserted and stalls the cpu.
0 Kudos
Altera_Forum
Honored Contributor II
459 Views

for unknown reason (a friend told me to try this) I needed to set the MSB to 1 so .. 0x0400000 is actually 0x8400000 .... solved !

0 Kudos
Altera_Forum
Honored Contributor II
459 Views

wait a minute... setting the MSb to 1 makes you bypass the cache on Nios2, not doing magic on the handshakes. Are you sure the problem is solved?

0 Kudos
Altera_Forum
Honored Contributor II
459 Views

 

--- Quote Start ---  

wait a minute... setting the MSb to 1 makes you bypass the cache on Nios2, not doing magic on the handshakes. Are you sure the problem is solved? 

--- Quote End ---  

 

 

Yep, can you explain why I need to bypass the cache ?
0 Kudos
Altera_Forum
Honored Contributor II
459 Views

Sorry, I made a mistake. I counted 8 digits instead of 7 so I thought you were bypassing cache. My observation was wrong. 

 

Really, I do not know what you are doing. I just wanted to make you think carefully about the "solution" you found. I mean that, if I were you, I would double check if I made some other small changes to the project in the meanwhile. Just to avoid facing again this problem without having fully understood it the first time. 

 

 

 

I don't pretend to teach anything to anyone, neither to oblige someone to do something. Mine is just an advice from a guy that faces his own bugs everyday... some of them introduced by unlucky patches introduced to solve others!
0 Kudos
Altera_Forum
Honored Contributor II
459 Views

Sorry, it is 8 digits, I still don't know what is bypass the cache you mentioned, i'll be more then happy to learn :) ....

0 Kudos
Altera_Forum
Honored Contributor II
459 Views

Bypassing the cache would probably prevent the CPU from reading a full cache line using pipelining or burst, so it does make a difference on how the component is accessed. What do you have at this address?

0 Kudos
Altera_Forum
Honored Contributor II
459 Views

10x for all the answers ... 

 

I have registers ... we are two students, one from SW and the other from HW, so I write the code for my friends firmware ... 

 

we use tjose addresses to turn on/off devices (lamp, motor, etc ...) 

 

but if I don't write 1 to the MSB the NIOS just stopping ... :(  

 

I just know it solved my problem since a friend encountered this problem last year ...
0 Kudos
Altera_Forum
Honored Contributor II
459 Views

You will need to disable the data cache in order to access the hardware registers (and get sensible actions from the hardware). 

The nios cpu itself shouldn't stop if it performs a cache line read/write, but your hardware device might be buggy (and fail to terminate the back to back cycles) and/or contain a register that just does a reset!
0 Kudos
Altera_Forum
Honored Contributor II
459 Views

or the fact that the CPU wants to write a full cache line could make it write at an address you didn't anticipate. 

Use the IORD/IOWR macros to access hardware instead of pointers, it will guarantee a cache bypass.
0 Kudos
Reply