Autostart of a C program
Sparko
Posts: 8
I have a working program written in C and saved to the EEPROM of a Propeller P8X32A . The program autostarts fine while powered up with a USB cable to the PC the program was written and compiled on. It also autostarts fine when powered by any PC with Simple IDE software and drivers installed.
The Propeller C based program will not start when powered up with an AC to USB power adapter. It will not start when powered by a PC that has not had Simple IDE and drivers installed.
Please tell me what I need to get the autostart working.
Below is the first part of the C program:
Thank you Sparko
#include "simpletools.h" // Library include
void blink(); // Forward declaration
volatile int reps = 0; // <-- add
volatile int buttonchange = 0;
volatile int pulses = 0;
volatile int poc1sel =0;
volatile int poc2sel =0;
int button1 = 0;
int button2 = 0;
int main() // Main function
{
cog_run(&blink, 120); // <-- change! // Run blink ...
while(1) // <-- add
{
print("poc1sel = %d\n", poc1sel);
............................
The Propeller C based program will not start when powered up with an AC to USB power adapter. It will not start when powered by a PC that has not had Simple IDE and drivers installed.
Please tell me what I need to get the autostart working.
Below is the first part of the C program:
Thank you Sparko
#include "simpletools.h" // Library include
void blink(); // Forward declaration
volatile int reps = 0; // <-- add
volatile int buttonchange = 0;
volatile int pulses = 0;
volatile int poc1sel =0;
volatile int poc2sel =0;
int button1 = 0;
int button2 = 0;
int main() // Main function
{
cog_run(&blink, 120); // <-- change! // Run blink ...
while(1) // <-- add
{
print("poc1sel = %d\n", poc1sel);
............................
Comments
As a side note - you're using "print" instead of "printi". printi is an equivalent to print, but does not support floating point variables. You'll save a lot of code space by switching.
This sounds more like a power related issue than a software related issue, but I could be wrong.
The more information you provide, the better assistance you will receive.
What type of board are you using and what type of power supply?
That sounds like a darn good diagnosis
Your assumption is correct, I am developing using the Multicore Development Board. When I purchased it I noted that it had an onboard EEPROM so I may have incorrectly assumed it would autostart the program.
So my basic question is whether or not this board will autostart with a non-PC USB power supply or do I need another board to drop the code into?
If I need a board that will autostart what would be the least expensive board that Parallax offers? I am hoping to produce quantities of these very trivial controllers so keeping the price down would be helpful.
So far my C code is only about 100 lines. I need only 5 inputs and 8 outputs.
I will proceed by testing with a PC along side the development board and machinery being controlled.
Thank you very much
Sparko
Swindude - Thanks for the tip on printing. Printing was just in the code to be able to see how the program was reacting to the inputs. I would likely be removed in the final product.
"I think the problem is related to the hardware, not the software. The original post indicated using a P8X32A, so my assumption was a custom system. Now I am wondering if it is in fact a development board or one that uses the FTDI chip with power-switching circuitry. If that's the case the board may not work since the USB chip won't be enumerated and enable the power pin output when not connected to a USB host controller. The USB power adapter usually won't have that feature/functionality"
This will allow the board to accept power through the USB connector without the need of communicating with the PC first.
That's it. I tried what you suggested and it worked.
Sure appreciated it. Since this morning I read the Propeller data sheet and from the two paragraphs below I suspected there was a way. You filled in the blank for me. (See section b. below.)
Thanks a lot.
Sparko
2. The Boot Loader performs one or more of the
following tasks, in order:
a. Detects communication from a host, such as a
PC, on pins P30 and P31. If communication
from a host is detected, the Boot Loader
converses with the host to identify the Propeller
chip and possibly download a program into
global RAM and optionally into an external 32
KB EEPROM.
b. If no host communication was detected, the Boot
Loader looks for an external 32 KB EEPROM on
pins P28 and P29. If an EEPROM is detected,
the entire 32 KB data image is If an EEPROM is detected,
the entire 32 KB data image is loaded into the
Propeller chip’s global RAM.