MOD54515 - not able to upload a program file

Discussion to talk about software related topics only.
Post Reply
montambaultp
Posts: 5
Joined: Sun Jun 09, 2013 6:21 pm

MOD54515 - not able to upload a program file

Post by montambaultp »

Hi,

I have create a mistake in my program. I create a class Controller. In this class, i have create a method Initialize and run like this:

Code: Select all

void DoorController::Initialize()
{
	InitializeStack();
	if (EthernetIP == 0) GetDHCPAddress();
	OSChangePrio(MAIN_PRIO);
	EnableAutoUpdate();
	StartHTTP();
	EnableTaskMonitor();

	PtrToObjectGlobalWebServerHandler = &WebServerHandler_Object;

	MyPostHandlerRegister(WebServerHandler::MyDoPostWrapper);
}

void DoorController::Run()
{
    while (1)
    {
        OSTimeDly(20);
    }
}
But in the usermain i dont create my object Controller like this:

Code: Select all


void UserMain(void * pd)
{

   // DoorController DoorControllerMain;
  
    // DoorControllerMain.Run();

}
The usermain is empty. I don't able to push the correct program in the MOD.

Anybody have an idea for correct my problem?

Thank you
User avatar
tod
Posts: 587
Joined: Sat Apr 26, 2008 8:27 am
Location: Southern California
Contact:

Re: MOD54515 - not able to upload a program file

Post by tod »

You'll need to use the serial port (using the USB connection is fine). This pdf document from the Wiki FAQ has very detailed instructions.
User avatar
tod
Posts: 587
Joined: Sat Apr 26, 2008 8:27 am
Location: Southern California
Contact:

Re: MOD54515 - not able to upload a program file

Post by tod »

Also, I'm assuming that something in the constructor for DoorController is calling Initialize.

[Unsolicited advice]
I would question if any of the board setup code belongs in DoorController. Having it in there makes DoorController:
  1. unsuitable for a library
  2. less reusable
  3. impossible to unit test
  4. violate the single responsibility principle

In your code I also wouldn't have the setup of the PostHandler in DoorController.

You might consider putting something like

Code: Select all

const int SAFETY_DELAY_6_SECS = 120;
OSTimeDly(SAFETY_DELAY_6_SECS );
as the last statement of your UserMain before you instantiate DoorController and call the run method. That way if something in your code traps fairly quickly you can just reboot and the 6 seconds will probably give you enough time to do an Ethernet download. (You can increase/reduce the time based on how long your download takes). My preferred approach is to write all new code in a library and use a unit testing framework to test it first. That way, if it traps the NB reboots and all I have to do is not run that test again and I can always reload a new build over Ethernet.
[/Unsolicited advice]
montambaultp
Posts: 5
Joined: Sun Jun 09, 2013 6:21 pm

Re: MOD54515 - not able to upload a program file

Post by montambaultp »

tod wrote:You'll need to use the serial port (using the USB connection is fine). This pdf document from the Wiki FAQ has very detailed instructions.
Return of the MOD54415

Thank you Tod
Post Reply