Forum Discussion
Altera_Forum
Honored Contributor
15 years agoHaven't actually used the DE2 Media Computer example myself before, but in the case of a normal project in which you create the SOPC system, you would simply create your Nios CPU, SRAM controller first in SOPC builder. Then...when you create a new app and board-support package (BSP) in Nios II build tools, the IDE will automatically create a BSP to support your desired hardware incl a HAL driver to enable read/write operations to the SRAM in your C code.
To transmit data over TCP/IP, you'll need to use Nichestack provided by Altera (as your best option). Alternatively, for simple communications using the UDP protocol, BTXSistemas (another forum user) has some good code based on the DE2_NET example provided by Terrasic. Check out my post on using Altera's socket server ref design on the DE2 board: http://www.alteraforum.com/forum/showthread.php?t=24020 And yes, all TCP/IP and socket comms are handled in C. In the case of the socket server example (provided by Altera), Nichestack is a C library which provides TCP/IP communications support on the Nios II platform. Nichestack requires the MicroC/OS-II RTOS provided by Altera to run - although everything is built into the ref design (included in Nios II build tools). Once everything is running, you can easily write and receive data over a socket using simple C commands such as send and recv. I have also developed a custom handshaking protocol which provides a basis for sending large quanitities of data over a socket ie. to a PC.