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++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
12748 Discussions

Trouble with creating multiprocessor Nios II system with shared memory

Altera_Forum
Honored Contributor II
2,025 Views

Hello, 

 

I have created a multiprocessor Nios II system with two cpus sharing on-chip memory to print to the console (JTAG UART). I used the Altera "Creating Multiprocessor Nios II Systems Tutorial" for reference. I also used the example application hello_world_multi.c that is used in this tutorial. I got it off the Altera website. 

 

It worked fine for a system with two CPUs, but it did not work when I tried it for three or four cpus. According to the tutorial, this application is expected to work for three (or more) CPUs. But when I tried that, only two of the CPUs print to the console while the other one/two are starved. It appears like the first two CPUs who get the mutex, get it always and the other(s) is/are starved. Since this application is expected to work for three CPUs, I don't see why this should happen. 

 

I am using the Altera DE2 board, Quartus II 8.0 and Nios II IDE 8.0. My SOPC system has three CPUs, a mutex core and a shared memory component. I would appreciate any help/insight with this. 

 

Thanks.
0 Kudos
8 Replies
Altera_Forum
Honored Contributor II
1,002 Views

Are all your Cpus trying to lock the mutex at the same time? Arbitration between different Avalon masters isn't always fair, and it could result in giving access to the same CPUs. 

You could try and acquire the mutex through the altera_avalon_mutex_trylock() and wait a random number of cycles before trying again if it fails.
0 Kudos
Altera_Forum
Honored Contributor II
1,002 Views

I'm not familiar enough with the example design but my first impression is the same as Daixiwen's. It sounds like the first two cpu's are beating out the other two when aquiring the mutex. If you want some mechanism to ensure everyone gets a fair shot at it, you're going to have to add it. 

If you want to verify that the other processors can indeed get the mutex, you can run all processor's in the debugger, then pause the first two and see if the other processors are able to get the mutex. 

 

Jake
0 Kudos
Altera_Forum
Honored Contributor II
1,002 Views

Goto Quartus meniu "Assignements" find "Device". After that find Analysis & Synthesis Settings and uncheck: Power-Up Don't Care. 

 

If this will not help. Try to build some counter that holds reset for example one second. Maybe there is a problem that CPU3 is gets not all software from EPCS and try to run when it incomplete. So reset hold may help to solve this problem.
0 Kudos
Altera_Forum
Honored Contributor II
1,002 Views

Thanks for your replies, everyone. I went to SOPC builder 'View' menu --> 'Show Arbitration' and increased the Arbitration share for the starved CPU. That is working for now. But it appears like I need to acquire more knowledge about arbitration on the Avalon Bus.  

 

Are the 'Avalon Bus' and 'Avalon Interconnect for Avalon MM components' essentially the same? I did not find any specification manual for the 'Avalon Bus' on the Altera website. The SOPC builder 'Help' also talks about 'Avalon Interconnect' rather than the 'Avalon bus'. 

 

Thanks.
0 Kudos
Altera_Forum
Honored Contributor II
1,002 Views

Avalon Bus refers to basically the signals available to Avalon MM slaves and masters and how they function. Avalon Interconnect Fabric refers to the overall bus interconnect system (how masters and slaves are wired together, how arbitration is handled, how addressing is handled, etc.) 

 

Jake
0 Kudos
Altera_Forum
Honored Contributor II
1,001 Views

Thank you, Jake. 

 

PPB
0 Kudos
Altera_Forum
Honored Contributor II
1,002 Views

Hello, 

 

I also have created a multiprocessor Nios II system with two cpus sharing on-chip memory not print to the console (JTAG UART).  

The cpu1 runs a TCP/IP stack(controlled bu ucosII) and accept commands from cpu2 

I am using the Altera DE2 board, Quartus II 7.0 and Nios II IDE 7.0.  

But only the cpu1 can run successfully when run the project on nios II hardware, and informed as follow: 

"another application is using the target processor (or is using the jtag cable in a way which conflicts with our request to use the target processor). 

please close down that application and try again" 

 

how can I deal with the problem? 

Could you send me the example application hello_world_multi to me(Because I can't find it on the net)  

my email:yangwangzhihao@163.com 

Thanks!
0 Kudos
Altera_Forum
Honored Contributor II
1,002 Views

last, i change to use the quartus II  

the problem no happens again.
0 Kudos
Reply