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

Uart printf problems

Altera_Forum
Honored Contributor II
1,019 Views

Hi all, 

 

I'm trying to run a simple "Hello Word" program in a Nios project on a Opus103 EVB. 

 

The device is EP1C6144, with an extrernal 2Mb 16-bit wide SDRAM connected to it. 

 

Using the standard "Hello Word" from NiosII IDE I see printed on both UART and JtagUART 

 

"HHllooffoo iissII!!" 

 

instead of 

 

"Hello from NiosII!" 

 

The project is compiled with all data (.text, .rodata, .rwdata) mapped in external SDRAM. Using variables for computational purposes, watching memory and variables inspection windows, everything looks well... but printf doesn't give the expected output. 

 

The only way to fix this problem is put at least .rwdata objects in internal RAM. 

 

Does anyone have an idea of what is wrong in my project? 

 

Than you, 

 

Paolo
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
285 Views

I'm not familiar with the board you're using, but it looks a lot like you've got a problem in your SDRAM interface. My hunch is that the lower address bit is stuck (e.g. always 0) so that on a set of sequential byte accesses you wind up getting the sequence you've shown. 

 

The reason this wouldn't cause problems for fetching the code itself is that this will be word aligned.
0 Kudos
Altera_Forum
Honored Contributor II
285 Views

I checked A0 and it is well behaved, it goes correctly from 0 to 1 and viceversa... 

 

Now I see the program crashing also using internal RAM for .rwdata... It prints well, but crashes... 

 

I'm thinking about SDRAM clock phase...  

 

Thank you however... 

 

Paolo
0 Kudos
Altera_Forum
Honored Contributor II
285 Views

Continued on sdram byte (8-bit) write access (http://www.niosforum.com/forum/index.php?act=st&f=2&t=1443) topic...

0 Kudos
Reply