- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nios2 is new to me and I'm developing a custom component on it.
I have my Avalon regester interface ready. I can IOWR a integer into the regester to perform the function, but fail to IORD from the same reg. (IORD the same reg give me 0). The reg is 32 bit wide, is there anything to do with the address? It's not one of the delay problem, because i wrote a while{} loop to read it, but still, can't get what I just IOWR. It could be silly, but please answer it in detail, since i'm really new here.Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That should have worked. You might want to copy and paste the code fragments. Are you sure you have the readdata signal in your component wired up correctly?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is this a custom SOPC Component using VHDL/verilog?.
Did you provide the capability of reading this register? This could also be a HW timing issue with reads and/or writes. If this is a brand new Component I would recommend simulating the component or using Signal Tap to watch the appropriate registers, control signals, and data buses.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am also getting the same issue, using IOWR_32DIRECT doesn't produce error and printfs after that call work, but as soon as I call IORD_32DIRECT, the printfs afterwards do not show. Does anyone know any possible reasons as to why my code is hanging up at IORD_32DIRECT?
(The usleep(20000)s are a way to "flush" the stdout buffers because I was having this issue: https://www.altera.com/support/support-resources/knowledge-base/solutions/rd07292005_415.html)#include <alt_types.h>#include <io.h># include <string.h># include "system.h"
# include "sys/alt_dma.h"
# include "sys/alt_flash.h"# include "sys/alt_flash_dev.h"# include "sys/alt_flash_dev.h"# include "sys/alt_stdio.h"//for alt_putbufflush()# include <stdio.h>
int main()
{
//===============Set Address===============
//int *THE_ADDRESS;
//THE_ADDRESS = (int)ADDRESS_SPAN_EXTENDER_0_WINDOWED_SLAVE_BASE;
int THE_ADDRESS;
THE_ADDRESS = (int)SINKSOURCE_0_BASE;
//===============Write===============
printf("Reading from Address: %08x \n", THE_ADDRESS);
usleep(200000);
printf("THE_ADDRESS: %08x \n", THE_ADDRESS);
usleep(200000);
int write_val = 0xffff;
IOWR_32DIRECT(THE_ADDRESS,0, write_val);
usleep(200000);
printf("Wrote %08x to %08x \n", write_val, THE_ADDRESS);
usleep(200000);
//===============Read===============
usleep(200000);
int val = IORD_32DIRECT(SINKSOURCE_0_BASE, 0); //PROGRAM STOPS HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
usleep(200000);
printf("Value at %08x: %08x \n", SINKSOURCE_0_BASE, val);
usleep(200000);
return 0;
}

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page