[Lab 3] Common access to LEDs

[Lab 3] Common access to LEDs

by Matthias René Wüst -
Number of replies: 1

Hello,

I'm having trouble to understand the parallel port test (3.1). When we tried a shared access to the LEDs, we got the following error:


Are we supposed to test this access for each processor individually?  Or can we simply assign a number of LEDs to one processor and the remaining ones to the other? Or do we need to build a system architecture such that the seperate paraPorts communicate with the shared paraPort, which in turn accesses the LEDs? The latter makes the most sense to me, as it is described in the next step (hardware mutex), but maybe this isn't the idea for the LEDs?

Here is a section of our .qsys implementation with PIO being the shared parallel Port. Thank you for your help.


In reply to Matthias René Wüst

Re: [Lab 3] Common access to LEDs

by Sahand Kashani-Akhavan -

There is not enough information in your post to solve everything. 

I see in your qsys file you have leds_1, so I'm guessing there's a leds_0 somewhere too? Based on the error message I see, I think you've connected two different LEDs to the same LEDR in your top-level file (it's a VHDL problem).

You cannot share pins like that as a pin can only have a single driver (unless it is tri-stated, but that's not the goal here). If you want both processors to have access to the LEDs, then you have 2 options:

  1. Have 2 PIOs of 5 bits and connect each to a different processor. Each processor has access to a subset of the LEDs with such a configuration.
  2. Have 1 PIO of 10 bits and connect both processors to it so each processor can access all the LEDs. The avalon bus will do arbitration and only allow a single processor to access the PIO unit at a time, but if software needs higher-level synchronization (like when you want to read-modify-write the LEDS' value), then you'd need a software locking mechanism like a mutex or a semaphore on top of the hardware.