SimpleIDE Terminal Doesn't Show when `printf`ed
sshaginyan
Posts: 9
I have a p8X32A breakout board https://www.sparkfun.com/products/11525 and a FTDI Basic Breakout - 3.3V https://www.sparkfun.com/products/9873. Everything is working, however I can't get the printf function is display information within the SimpleIDE Terminal. I've read the documentation https://sites.google.com/site/propellergcc/documentation/libraries#TOC-COG-Device-Library and tried these the examples there. I've also tried running the hello.c example program with no success. Is there anything special I need to do to stdout stdin strerror streams? Maybe redirect them?
I know the standard baud rate is 115200 and for board type I have RCFAST.
I've tried setting a baud rate with
and
I know the standard baud rate is 115200 and for board type I have RCFAST.
I've tried setting a baud rate with
[COLOR=#006000][FONT=monospace]freopen("SSER:9600,31,30", "w", stdout); [/FONT][/COLOR]
and
[COLOR=#006000][FONT=monospace]waitcnt(CLKFREQ+CNT);[/FONT][/COLOR]
/* Blank Simple Project.c Click Help and select Tutorials to see lots of code examples. */ #include "simpletools.h" // Include simple tools int main() // Main function { // Add startup code here. while(1) // Repeat indefinitely { printf("Hello world"); pause(1000); } }
Comments
Try going into C:\propgcc\propeller-load
Copy hub.cfg as custom.cfg.
Open custom.cfg with a text editor and change the text to this, then save:
# custom.cfg
clkfreq: 64000000
clkmode: XTAL1+PLL8X
baudrate: 57600
rxpin: 31
txpin: 30
I changed the baud rate to 57600. 115200 might work for both, not sure, so I decided to try lower since the 8 MHz crystal forces the system clock from 80 MHz to 64 MHz.
[edit] Open boards.txt, note the pattern of .cfg files listed, and add a line for custom.cfg [/edit]
After saving the file, if you are in Simple View, click the bottom-left Show Project Manager button (if it isn't already visible along the left). Then, click the puzzle piece next to the Board Type dropdown to refresh the list. Then, select Generic in the Board Type dropdown.
Click Run with Terminal, and good luck...
[edit] You might have to manually change that in Simple Terminal, then re-run so that the 57600 setting persists. [/edit]
Sounds like you can't get a 5 MHz oscillator. 4 MHz oscillator can only go up to 64 MHz because the Propeller chip's phase locked loop that generates the system clock can bump up the input frequency by up to 16x.
5, 10, and 20 MHz oscillators are better values if the goal is to run the system clock at 80 MHz.
The values you will update in custom.cft are PLL, clkfreq, and maybe XTAL. clkfreq = oscillator x PLLnX, where X can be 1, 2, 4, 8, or 16. Example: Oscillator is 10 MHz, so use PLL8X to run your system clock at 80 MHz (clkfreq: 80000000 in your .cfg file). XTAL1 is good up to 16 MHz, so you'd need to change to XTAL2 for a 20 MHz oscillator, and you'd also use PLL4X for clkfreq: 80000000.
(XTAL values from Propeller Manual, page 68. Search www.parallax.com for Propeller Manual to find the download.)
Andy