You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Micropendous
Hello,
I have a Mega32U2. I built the VirtualSerial Demo and I can control
the demo from a serial console like TerraTerm. From within the
MainTaskLoop, I can print messages and they appear in the serial
console. However, when I add more source files to the project and
then attempt to print from the functions in the other source files,
the output never appears. The code does not crash and when I look at
the listing file, it appears that these lower code sections are
calling the same fputs() as the prints in the MainTaskLoop. If I
search the elf file, the message strings from the printfs of the lower
code levels are included. With the additional code added, printf
from the MainTaskLoop still works. I tried suppressing all printfs
from the MainTaskLoop to see if it was stuck in a buffer somewhere
that was getting overwritten, but still no joy.
What is the trick to get printf to work from any level of the code?
Thanks.
--- Steve
P.S. I tried to switch over the the RTOS version. While I can get
that version to compile, it will not enumerate as a Serial Port in my
Windows XP.
Opendous Inc.
unread,
Jun 8, 2012, 8:54:13 PM6/8/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
Move the "static FILE USBSerialStream;" line to a header file such as
USBVirtualSerial.h and include that header in your other source files.
This sort of configuration allows the default stream files, 0(stdin),
1(stdout), and 2(stderr) to be used for another stream such as UART.
I suggest you port all your print code to the stream versions (f...).
It helps with readability and allows you to print to any number of
different files. Since the print system just requires custom putchar
and getchar functions, you can print to SPI, memory, GPIO, or anything
you can think of.
http://www.nongnu.org/avr-libc/user-manual/group__avr__stdio.html
I will look into WinXP and the RTOS version. I too have had problems
but I thought they were solved in this version.
smi...@gach.us
unread,
Jun 10, 2012, 11:29:31 PM6/10/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Micropendous
Ok,
I tried moving the {static FILE USBSerialStream; } into the header
file and then including that header file. However, this too fails to
print for me from the lower level of code. I created a simple test
case that displays what I am seeing. Unfortunately, there does not
appear to be a way to attach the zip file to this group. Where can I
upload the test case?
Thanks.
---- Steve
Opendous Support
unread,
Jun 11, 2012, 2:15:20 PM6/11/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to microp...@googlegroups.com
If you reply to the group email with an attachment it should work but
please avoid large files (>100kb).
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to microp...@googlegroups.com
Switched to the "new" Google Groups and that version has an upload option. Attached is modified files that have the fprintf issue when I run them. My board is a Mega32U2, so you will have to modify the makefile to reference your HW version.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to microp...@googlegroups.com
The solution was to make the FILE variable extern in the header,
"extern FILE USBSerialStream;", and then just "FILE USBSerialStream;"
in the source. I spaced on the fact that static limits the scope of a
variable to the enclosing source file.
http://en.wikipedia.org/wiki/Static_variable
The zip contents are meant to replace the VirtualSerial directory
from the latest Micropendous release (Micropendous-2011-11-26). I
made some minor changes to your test print. Non-variable text should
really be in fprintf_P(PSTR ... ) to limit RAM usage.