- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hello,
i have a NiosII sopc with a PIO[24] called LED. It is connected to the LEDs on the DE3 board. now i have a simple application :# define LED_BASE 0x00041010 // this is the base in the sopcbuilder
....
int led_val = 0x0;
IOWR_ALTERA_AVALON_PIO_DATA( LED_BASE, led_val);
But the Leds are alway on. also when i change led_val to something else, nothing happens. and another question? why is a pointer to a pio alway implemented as char pointer??
Link kopiert
5 Antworten
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
In sopc builder have you defined this pio as output only or bidir? If the latter, you need to set the direction bits for outputs.
Check also in Quartus project if all connections are ok and signals are assigned to right pins. Regarding your question about pointers, using char is not mandatory. Infact you can use int when your pio is up to 32bits wide. Probably all samples use char because this is the native addressing mode of processor. Cris- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
in sopc the LEDs are only output.
In Quartus i have a Blockdiagram with the nios-system and outputs connected to the leds (in the pin assignment they are connected as well) the Blockdiagramm is set as top level entity. Another thing i tried is this:# define Buttons (volatile char *) 0x00040000# define LEDs (char *) 0x00041010
void main()
{ while (1)
*LEDs = *Buttons;
}
Nothing happens... And another question, i have all unused pins set as input. there is a 7-segment display on the board which i do not use. but two of the lighsts are on.. how can this be?
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hi goaran,
Regarding the code you posted, I'd recommend this: - always use the defines in system.h instead of numeric addresses - always use IORD/IOWR macros to access pio registers; I had similar situations where the trick with pointers didn't work (I'm not sure why) Regarding the two segments always on, this depends where they are actually connected. If you use an input, the level is not well defined: a pull up/down on the signal can alter the signal level. I suggest you connect them to outputs or hardwire them to Vcc or gnd inside fpga. Cris- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
If you don't use the IORD/IOWR macros, you need to remember to bypass any data cache.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Ok, thanks
I used the adreses from System.h and now its working. But i dont know really why. the Adresses i defined were the same as the base adresses in the SOPC builder.
Antworten
Themen-Optionen
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite