Altera Forum






Threads: 18,959
Posts: 77,485
Members: 29,244
Welcome to our newest member, pearl87
User
Reputation
9135
7620
5891
4150
3030
2197
2056
1706
1388
1300




 
Register
Quick Search
 
  Altera Forums > IP and Dev Kit Related > Nios Forum > General Discussion > General Software Forum

Weird Operation With Out PRINTF

Reply
 
Thread Tools Display Modes
  #1  
Old August 29th, 2006, 02:08 PM
cfavreau cfavreau is offline
Altera Scholar
 
Join Date: Jun 2006
Location: Somewhere in EST
Posts: 43
Rep Power: 1566
cfavreau is on a distinguished road
Default

Is anyone experiencing weird problems if you don't use any printf's in the main loop?

I am having problems with using the DMA to transmit data using a UART. The UART transmits junk data (the correct number of bytes just not the correct bytes) when the printf is absent from my main loop. If I place the printf in the main loop everthing works fine.

I think I also experience something similar with uClinux. From what I can remember (a month ago), my thread would not process unless I had a printf in my main loop.

Has anyone else had any experiences similar to these?

Thanks in advance.
Reply With Quote
  #2  
Old August 30th, 2006, 05:01 PM
slacker slacker is offline
Altera Guru
 
Join Date: Apr 2004
Location: Palo Alto, CA
Posts: 651
Rep Power: 2951
slacker is a name known to allslacker is a name known to allslacker is a name known to allslacker is a name known to allslacker is a name known to allslacker is a name known to all
Default

What are you pointing the DMA's RADDRESS (read address) towards?

I don't think your issue has anything to do with whether you're using printf or not, as I've found that pointing RADDRESS at non stack-resident variables tends to work (global, statically declared variables, or malloc'ed buffers), whereas anything stack/function resident will return garbage.

A simple check (to see if I'm correct) would be to add the 'static' qualifier to any of your stack-resident variables to see if that helps.

Cheers,

- slacker
Reply With Quote
  #3  
Old September 5th, 2006, 12:03 PM
cfavreau cfavreau is offline
Altera Scholar
 
Join Date: Jun 2006
Location: Somewhere in EST
Posts: 43
Rep Power: 1566
cfavreau is on a distinguished road
Default

I point the RADDRESS at a pointer to memory that is malloced.

Yeah I agree that it probably doesn't have anything to do with printf... however I cannot find any other thing to make it work right. I have a feeling that printf just does something in the system that helps the transfer along... or accesses memory in a certain way... or something... Not really sure.

The funny thing is ... is that the data that is transmitted when the printf is absent is not all garbage... it is only part garbage... maybe everyother byte or so.... although I haven't looked at it in minute detail.

Thansk for the reply so far... I will try making the buffer pointer static and see if that works for now.... as far as I know the data isn't on the stack... just the pointer.

Any other insight into the mystery will be appreciated!
Reply With Quote
  #4  
Old September 5th, 2006, 03:10 PM
slacker slacker is offline
Altera Guru
 
Join Date: Apr 2004
Location: Palo Alto, CA
Posts: 651
Rep Power: 2951
slacker is a name known to allslacker is a name known to allslacker is a name known to allslacker is a name known to allslacker is a name known to allslacker is a name known to all
Default

I'm not sure what your issue could be, but perhaps the CPU's data cache could be playing a role? Have you tried the uncached malloc?

Cheers,

- slacker
Reply With Quote
  #5  
Old September 6th, 2006, 12:44 PM
cfavreau cfavreau is offline
Altera Scholar
 
Join Date: Jun 2006
Location: Somewhere in EST
Posts: 43
Rep Power: 1566
cfavreau is on a distinguished road
Default

Ok I will try using the alt_uncached_malloc() function. I guess I also could try bypassing the cache too... by adding the 0x8x... on the front of the address.

Thanks!
Reply With Quote
  #6  
Old September 6th, 2006, 08:24 PM
cfavreau cfavreau is offline
Altera Scholar
 
Join Date: Jun 2006
Location: Somewhere in EST
Posts: 43
Rep Power: 1566
cfavreau is on a distinguished road
Default

Well all be darned!

That worked fantastic. Using the uncached malloc worked great! The problem does not show up when using a non cached buffer. Funny thing is that the address for a non cached buffer is in the 0x8... adress range (which sets the bit to bypass the data cache).

Thanks for your help! You saved me another month of agonizing does this work or does that work...
Reply With Quote
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
weird problem with dm9000a on de2 jwlam Linux Forum 1 November 19th, 2009 10:40 PM
Weird voltage level ecenus Quartus II and EDA Tools Discussion 2 May 4th, 2009 03:07 AM
Weird Problem With MAX II Dev Kit Nahum FPGA, Hardcopy, and CPLD Discussion 2 January 19th, 2009 10:04 PM
a weird issue David_Cai General Discussion Forum 7 January 23rd, 2006 11:52 PM
a weird issue with wrctl instruction David_Cai General Software Forum 0 January 17th, 2006 09:59 AM


All times are GMT -8. The time now is 09:44 PM.