- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, i have a problem with reading data from sdram in nios using IORD_16direct. There is my code of sending data to sdram.
for(i = 0; i < 10; i++) { int chromosome[30] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 }; int randomFirstPoint = onGetRandom(0, 29); int randomSecondPoint = onGetRandom(0, 29); int buff = chromosome[randomFirstPoint]; chromosome[randomFirstPoint] = chromosome[randomSecondPoint]; chromosome[randomSecondPoint] = buff; for (j = 0; j < 30; j++) { IOWR_16DIRECT(DRAM_BASE + count, 0, chromosome[j]); count++; } } and there is my code of redaing from sdram for(i = 0; i < 300; i++) { int value = IORD_16DIRECT(DRAM_BASE + i, 0); printf("read value = %d %d\n", value, i); } output is read value = 1 read value = 0 -- incorrect value instead of this would be 2 read value = 3 read value = 16128 -- incorrect value instead of this would be 4 read value = 5 read value = 0 -- incorrect value instead of this would be 6 read value = 7 read value = 16128 -- incorrect value instead of this would be 8 read value = 9 read value = 0 -- incorrect value instead of this would be 10 and so on...Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't undestand what it is a forum if nobody can't help me?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Nurbek,
Debug the code using following steps. 1.Print the write and read address and verify. 2.Or instead of for loop can try something much simpler(write to two address and read from the two without loop) if u succeed try with loop. Best Regards, Anand Raj Shankar (This message was posted on behalf of Intel Corporation)
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