Power on sequence, modem off

Home Forums Dragonfly Power on sequence, modem off

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #12460
    Will Blight
    Participant

    I am working on a low current (battery powered) application. Power to the dragonfly is removed most of the time. When power is applied I do not want the modem to power up immediately it uses to much current. I need the M4 to work for a period of time and then power on the modem and send the data.
    I created the code below by combining the HTTP example, Flash example and the low power example code on mbed.
    If I used the HTTP example code the dragonfly powers up, connects to the website and post data in about 15 to 20 seconds. If I use the code below to keep the modem powered down after power has been applied, sometimes (not always) when I power up the modem in code it takes minutes (if ever) to connect to the server and post the data.

    My question is: what is the correct sequence of events to power off the modem when power is first applied and to power it back on at a later time?

    Thanks.

    My code looks like this: (it was nicely formatted before I hit the submit button.)
    Int main()
    {
    //keep modem powered off.
    radio_pwr = 0;
    radio_reset = 0;

    bc_nce = 1;
    wait_ms(100);

    Process_this();
    Process_that();

    log(“changing regulator to 1A mode \n”);
    bc_en1 = 0;
    bc_en2 = 1;
    log(“waking up the SPI flash \n”);
    //flash code not shown.
    flash.wakeup();
    read_values_from_flash();

    wait_ms(100);

    radio_reset = 1;
    wait_ms(100);

    log(“powering on radio \n”);
    radio_pwr = 1;
    radio_reset = 1;
    int tries = 0;

    log(“radio_ok = init_mtsas() \n”);
    radio_ok = init_mtsas();
    if (! radio_ok) {
    log(“failed to initialize cellular radio \n”);
    shutdown();
    }

    while (radio->sendBasicCommand(“AT”, 1000) != MTS_SUCCESS) {
    //wait(1);
    wait_ms(200);
    tries++;
    if (tries % 100 == 0) {
    radio_reset = 0;
    wait_ms(10);
    radio_reset = 1;
    }
    log(“.”);
    }
    log(“\n”);

    log(“setting APN \n”);
    if (radio->setApn(apn) != MTS_SUCCESS) {
    shutdown();
    }

    log(“bringing up the link \n”);
    if (! radio->connect()) {
    log(“failed to bring up the link \n”);
    shutdown();
    } else {
    // do HTTP stuff here
    }

    shutdown();
    }
    return 0;
    }

    #12466
    Mike Fiore
    Blocked

    Will,

    The Dragonfly low power example program you mentioned

    https://developer.mbed.org/teams/MultiTech/code/Dragonfly_Low_Power_Example/

    demonstrates how to properly shut down and turn on the radio.

    You should raise the radio_pwr line before raising the radio_reset line. Raising these lines in the opposite order as your application is currently doing could be the cause of your delays, I think.

    That is what I noticed right away, but since I don’t have your entire application, I can’t know for sure if there are any other issues.

    Cheers,

    Mike

    #12467
    Will Blight
    Participant

    Hi Mike,
    The rest of the code is from the examples. The HTML section is directly from the HTML example with the a slight change to use “GET” to post data.
    The shutdown() function is the code from the low power example. I am basically waiting for the modem to shutdown so I can remove power from the board safely.

    I have thoroughly tested the application code. I use functions outside of the main loop to perform the work I need done. Using printf() with the development kit and my oscilloscope monitoring output pins I can see that my functions complete correctly. The problem is in the modem section.

    I will remove the radio_reset from before the radio_pwr.

    I see in the while loop code:
    “while (radio->sendBasicCommand(“AT”, 1000) != MTS_SUCCESS)”

    that radio_reset is toggled off and on with a 10ms delay between. Is there a delay required between setting radio_pwr and setting radio_reset?

    Will.

    #12474
    Mike Fiore
    Blocked

    Will,

    No delay is required between raising radio power and radio reset. The radio_pwr line just has to be raised first.

    Cheers,

    -Mike

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.