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

Suggestions on effectively learning NIOSII Soft programing

Rezef
Novice
1,087 Views

Guys, I am planning to implement the SD card music player as demonstrated in the example of Altera de-2 115 version. In the example I noticed that I have to use NIOS 2 programing for establishing the SD card driver and extract the song data from the SD card through the NIOS 2 processor. Unfortunately, I don't have any prior experience in working with NIOS 2 programming. I do know that I have to use QSYS (Platform Designer) and implement the connection between the SD card through the ON Chip memory and NIOS processor but the C programing on the NIOS tool went above my head. Can you guys give me resources to effectively learn the NIOS 2 programing?

 

Any help would be greatly appreciated.

 

0 Kudos
1 Solution
EBERLAZARE_I_Intel
1,046 Views

Hi,


For starters, you can quickly run through any of the booting methods that your board can perform:

https://www.intel.com/content/www/us/en/docs/programmable/683689/current/processor-booting-methods.html


Choose boot from OCRAM for example:

https://www.intel.com/content/www/us/en/docs/programmable/683689/current/processor-booting-from-on-chip-memory-ocram.html


Go through the steps up until the "Programming" part.


For learning, you can go through the document as a whole.


View solution in original post

0 Kudos
9 Replies
EBERLAZARE_I_Intel
1,047 Views

Hi,


For starters, you can quickly run through any of the booting methods that your board can perform:

https://www.intel.com/content/www/us/en/docs/programmable/683689/current/processor-booting-methods.html


Choose boot from OCRAM for example:

https://www.intel.com/content/www/us/en/docs/programmable/683689/current/processor-booting-from-on-chip-memory-ocram.html


Go through the steps up until the "Programming" part.


For learning, you can go through the document as a whole.


0 Kudos
EBERLAZARE_I_Intel
1,022 Views

Hi,


Do you have any further update?


0 Kudos
Rezef
Novice
990 Views

Yes, I am going through the book and wanting to try out the simpler examples before moving onto the SD card part.For now I am trying to get on the handle of the syntaxes.Thanks for your suggestion

 

I do have some other problem to an example code I found for displaying LCD characters. In a certain line in the example the following line was written:

IOWR_ALTERA_AVALON_PIO_DATA(LCD_BITBANG_BASE,0x00600|data);

The documentation didn't explain any  thing for the above line.Is it doing an or operation among the hex datas?

0 Kudos
EBERLAZARE_I_Intel
969 Views

Hi,


Do you have the full example code/ example design?


From my knowledge, the PIO macros are defined in "altera_avalon_pio_regs.h". The macro "IOWR_ALTERA_AVALON_PIO_DATA" writes the output port.


0 Kudos
Rezef
Novice
957 Views

I meant the Bitwise Or operation.Here is the code:

#include "sys/alt_stdio.h"
#include "stdio.h"
#include "system.h"
#include "priv/alt_busy_sleep.h"
#include "altera_avalon_pio_regs.h"
#define LCD_BITBANG_BASE 0x11000

void SendCommand(alt_u8 cmd);
void SendData(alt_u8 data);
void SendMessage(char *msg);

int main()
{
SendCommand(0x0038);
SendCommand(0x0001);
SendCommand(0x0006);

SendMessage("IICT");
SendCommand(0x00C0);
SendMessage("FPGA");
SendCommand(0x000C);
return 0;
}

void SendCommand(alt_u8 cmd)
{
IOWR_ALTERA_AVALON_PIO_DATA(LCD_BITBANG_BASE,0x0400|cmd);
alt_busy_sleep(1000);
IOWR_ALTERA_AVALON_PIO_DATA(LCD_BITBANG_BASE,0x0000|cmd);
alt_busy_sleep(1000);
}
void SendData(alt_u8 data)
{
IOWR_ALTERA_AVALON_PIO_DATA(LCD_BITBANG_BASE,0x0600|data);
alt_busy_sleep(1000);
IOWR_ALTERA_AVALON_PIO_DATA(LCD_BITBANG_BASE,0x0200|data);
alt_busy_sleep(1000);
}
void SendMessage(char *msg)
{
while(*msg!=0)
{
SendData(*msg);
*msg++;
}
}

Also I saw some people using usleep instead of alt_busy_sleep.What are the comparative advantages of using one and the other?

0 Kudos
Rezef
Novice
949 Views

I think I have managed to grasp it now, It's essentially adding the Enable bit and RS and RW with the bitwise OR Operation along with the commands and data

0 Kudos
EBERLAZARE_I_Intel
920 Views

Hi,


The "alt_busy_sleep"; Microsecond delay routine which uses a calibrated busy loop to perform the delay. This is used to implement usleep for both uC/OS-II and the standalone HAL. I'll say it is quite common usage for Nios II designs.


Do you have any issues or have any other questions?


0 Kudos
Rezef
Novice
897 Views

I have no other questions for now. I really appreciate your help

0 Kudos
EBERLAZARE_I_Intel
881 Views

Hi,


Thanks for your update.


I’m glad that your question has been addressed, I now transition this thread to community support. If you have a new question, Please login to ‘https://supporttickets.intel.com’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.



p/s: If any answer from the community or Intel Support are helpful, please feel free to give best answer or rate 4/5 survey.


0 Kudos
Reply