printf wont work with pic32 example

dabaf wrote on Saturday, March 05, 2011:

I everybody,

I am using FreeRTOS demo program for PIC32MX360F512L and “printf” is not working. is there a setting that I have to make?
I just bought the PIC32 starter kit with the io expansion board, I also bought the book from FreeRTOS (FreeRTOS -a practical guide-pic32 edition). when I run my first progrm from the example001, nothing happen. I dont see what printing tasks as described in the book. is there someone who can point me to the right direction? thanx for your assistance

rtel wrote on Saturday, March 05, 2011:

> I am using FreeRTOS demo program for PIC32MX360F512L

The demos that come with the book are targeted at the PIC32 USB-II starter kit.  That has a PIC32MX795F512L part, which is newer than the PIC32MX360 series.  The newer part require one extra configuration option to function, and I’m not sure if that configuration option would prevent the older parts from working.  To test this theory, simply remove the line:

#pragma config FSRSSEL = PRIORITY_7

from main.c.

> and “printf” is
> not working.

The demos should be completely configured for printf() to output to an MPLAB window.  The call to DBINIT() within vSetupEnvironment(), called from main() configures this for you.

Finally, if you are using the very latest C30 version then the libraries changed the default output buffering from line buffered to no buffering.  This would not prevent output being generated, but does make it very slow.  I updated the book demos to include a call to vSetIOBuffering()  - so check your book demos have this call.

Hope this helps.


dabaf wrote on Saturday, March 05, 2011:

hi Richard,

I checked that all the functions you recommended were there(DBINIT() andvSetIOBuffering() called from vSetupEnvironment() ) I never changed anything in the example001. I commented out the< #pragma config FSRSSEL = PRIORITY_7 > line since it wont compile with it. still the printf wont work.

I had the idea of setting pins in PORTD as output  TRISD = 0; in main and putting the line PORTD =0X0001; in task1 and PORTD =0X0002; in task2 so I can see the change with my leds. the task1 light up for 1 second and off forever. the task2 light up just after the task1 and stay on forever. I guess it because I remove the < #pragma config FSRSSEL = PRIORITY_7 > .  but I can’t put it back since it won’t compile(main.c:44: error: unknown configuration setting: ‘FSRSSEL’). So I guess I am stuck… I wish I had the PIC32MX795F512L as recommended in the book.


ricklpray wrote on Friday, April 01, 2011:

I have the USB Starter Kit II and I was having the same problem.  I commented out the vSetIOBuffering(); and now I can see the output.  So the addition of vSetIOBuffering() broke the vPrintString() output for me.