Is there any way to detect what mode Mono is in?

  • When not connected to computer, is there any way to detect whether Mono is in sleep / bootloader / app running mode, as black screen could mean any of these three.

    I have multimeters and oscilloscope and I can open Mono if needed and could even do slight soldering if needed, but is there any way check current mode? (Of course the less I need to do the better, so that I don't accidentally damage Mono myself.)

  • @malaire sorry for my late response. It is not easy without a USB host. My first suggestion is to measure the 3V3 power line, but it is not flawless.

    Let me go through the 3 states you describe:

    Bootloader state

    Mono enters bootloader after a reset. If the bootloader detects the user button being pressed right after reset, it will wait forever in bootloader. (Until told to reset by a progranmmer or hardware reset.) Normally bootloader will exit after 1 sec.

    The bootloader does not interact with any peripheral, including the power subsystem. This normally means the 3V3 power line is active. This is because the power subsystem will enable this by default.

    However, if Mono is reset while being in sleep mode the 3V3 voltage is not active in bootloader. The power subsystem do not reset with Mono's MCU.

    The bootloader presents a HID end point on the USB.

    App running mode

    When the bootloader loads the app, the applications initialization code always turns on the 3V3 line. This ensure there is power to the display, even if Mono has been reset from sleep.

    Applications can also connect the 3V3 line to VAUX signal. But be aware that VAUX can also be connected to the BOOST power line that is up to 5V.

    A running app will present a CDC end point (a serial port) on the USB. (No HID)

    Sleep mode

    When entering sleep mode, the application will tell the power subsystem to turn off its auxiliary power lines. This disables 3V3 and the BOOST step up converter. (If it was enabled.) When Mono wakes, the 3V3 is automatically turned on again.

    In sleep the USB is completely off, nothing is presented on the port.

    A suggestion

    You could monitor the 3V3 signal. This will be on in bootloader (normally) and in app running mode. And off in sleep.

    To distinguish between app mode and bootloader your could manually assert a pin in app mode.


    Try to measure the the voltage levels on J_TIP in the different modes. You might be able to see voltage changes due to leakage currents in the transistor controlled by JPO_nEN.


  • I did few tests with Mono Maker connected to USB power source (not computer) and in this case measuring current with 1 mA accuracy can be used to detect current mode:

    • under 4 mA: sleep mode
    • about 18 mA: bootloader
    • about 30 mA: sleep mode with battery being charged
    • about 45 mA: bootloader with battery being charged
    • over 90 mA: app running

    ps. I didn't test if there are different charging levels, here battery was nearly full.

  • Great chart :-) 👍

    However, you are measuring a quite high current consumption in sleep mode. The MCU and power ship together should consume 35 - 40 µA. If you measure with the battery attached, you will also measure a charing current. Also, measuring with a multimeter set in mA precision will measure a higher current than actually present.

    To save power you can also try to change the brightness of the display:

    mono::IApplicationContext::Instance->DisplayController->setBrightness(0 - 255 );

  • I measured these with Log4.USB data-logger (another great KickStarter project) which has 0.1 mA accuracy. I usually got 1.3 mA average in sleep mode but sometimes more.

    Exact number isn't that important here as I just wanted to detect the mode. (For battery life estimation USB current isn't that useful - current from battery should be measured instead.)

Log in to reply