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++
12606 Discussions

communicating between UART and Memory dev ?

Altera_Forum
Honored Contributor II
1,619 Views

I am having a onchip memory on which i wish to write through input device like uart and futhur what ever i have written i want it to be looped back i.e then i want to read the contents from the memory. 

 

i can capture what ever is coming to uart but not sure how to write into the memory . Do i need to treat onchip as a device file simillar to uart and using fopen(),fread() etc commands to read and write into the memory. 

 

please help me out over this.. 

 

regards , 

Sankalp
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
402 Views

Hi Sankalp, 

 

You can always read and write to memory using below: 

 

IOWR_32DIRECT(address, offset, pattern); // for write 

 

IORD_32DIRECT(address, pattern); // for read 

 

-Baycool
0 Kudos
Altera_Forum
Honored Contributor II
402 Views

 

--- Quote Start ---  

originally posted by baycool@Sep 30 2005, 03:12 PM 

hi  sankalp, 

 

you can always read and write to memory using below: 

 

iowr_32direct(address, offset, pattern); // for write 

 

iord_32direct(address, pattern); // for read 

 

-baycool 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=10075) 

--- quote end ---  

 

--- Quote End ---  

 

 

hi , 

Could i know more about these functions? 

I am able to capture character through Uart using fget(ch) into a char variable, now how to use the above funtions to write into an onchip memory.i.e what will be the address,offset? 

Could you please help me out ? 

 

 

Regards, 

Sankalp
0 Kudos
Altera_Forum
Honored Contributor II
402 Views

To put it another way: 

 

 

IOWR_32DIRECT(base address, offset from base address, data you want to write); // for write 

 

IORD_32DIRECT(base address, offset from base address); // for read 

 

If you want to see their definitions take a look at components\altera_nios2\HAL\inc\io.h 

(they boil down to a data cache bypassing read or write instruction)
0 Kudos
Altera_Forum
Honored Contributor II
402 Views

 

--- Quote Start ---  

originally posted by sankalp.singhal@Oct 4 2005, 01:56 AM 

how to use the above funtions to write into an onchip memory.i.e what will be the address,offset?<div align='right'><{post_snapback}> (index.php?act=findpost&pid=10119) 

--- quote end ---  

 

--- Quote End ---  

 

Create the onchip memory peripheral in SOPC Builder, and give it an appropriate name. Regenerate your system. In the IDE, regenerate your project&#39;s system library. Open the system.h file in there and somewhere in there is the base address of the memory peripheral. 

 

For example, if I created an "On-chip memory (RAM or ROM)" device and named it "UART_cache", then regenerate SOPC, then regenerate system library, somewhere in the system library&#39;s system.h file will be a# define setting UART_CACHE_BASE to the base address of the on-chip memory. I don&#39;t remember if there is also a symbol generated for the memory&#39;s size.
0 Kudos
Altera_Forum
Honored Contributor II
402 Views

Hi there, 

 

Kindly, I have Terasic DE2-70 board with Nios 2 IDE v11.0 to develop some application on it, but I have a problem it is: how can I (store/read) data (to/from) my host computer(Hard Disk for example) on running time by using ANSII C library function such as (fopen() , fget(), fput(), .....); 

Could somebody please assist me on that. 

Thanks.....................
0 Kudos
Altera_Forum
Honored Contributor II
402 Views

You can do that only if you run your application with the debugger and use the host filesystem software component.

0 Kudos
Reply