Change the voltage of the high power pin on the Skyport V2 board ...
689 0 2023-2-12
Uploading and Loding Picture ...(0/1)
o(^-^)o
djiuser_KtYl0gScr6EJ
lvl.1

Australia
Offline

The PSDK has the power management which should allow the application to request high power mode (switch from 13.6V to 17V). I have the following code:

    auto returnCode = DjiPowerManagement_Init();
[color=var(--ds-text-subtlest, #505F79)  !important]2
[color=var(--ds-text-subtlest, #505F79)  !important]3
    if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
[color=var(--ds-text-subtlest, #505F79)  !important]4
    {
[color=var(--ds-text-subtlest, #505F79)  !important]5
        USER_LOG_ERROR("could not init, error code: 0x%08X", returnCode);
[color=var(--ds-text-subtlest, #505F79)  !important]6
        return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
[color=var(--ds-text-subtlest, #505F79)  !important]7
    }
[color=var(--ds-text-subtlest, #505F79)  !important]8
[color=var(--ds-text-subtlest, #505F79)  !important]9
    auto callback_val = [](E_DjiPowerManagementPinState pinState) -> T_DjiReturnCode
[color=var(--ds-text-subtlest, #505F79)  !important]10
    {
[color=var(--ds-text-subtlest, #505F79)  !important]11
        std::cout << "Got pin state from callback " << pinState << "\n";
[color=var(--ds-text-subtlest, #505F79)  !important]12
        return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
[color=var(--ds-text-subtlest, #505F79)  !important]13
    };
[color=var(--ds-text-subtlest, #505F79)  !important]14
[color=var(--ds-text-subtlest, #505F79)  !important]15
    DjiPowerManagement_RegWriteHighPowerApplyPinCallback(callback_val);
[color=var(--ds-text-subtlest, #505F79)  !important]16
[color=var(--ds-text-subtlest, #505F79)  !important]17
    returnCode = DjiPowerManagement_ApplyHighPowerSync();
[color=var(--ds-text-subtlest, #505F79)  !important]18
    if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
[color=var(--ds-text-subtlest, #505F79)  !important]19
    {
[color=var(--ds-text-subtlest, #505F79)  !important]20
        USER_LOG_ERROR(
[color=var(--ds-text-subtlest, #505F79)  !important]21
            "setting high power mode failed, error code: 0x%08X", returnCode
[color=var(--ds-text-subtlest, #505F79)  !important]22
        );
[color=var(--ds-text-subtlest, #505F79)  !important]23
        return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
[color=var(--ds-text-subtlest, #505F79)  !important]24
    }


    auto returnCode = DjiPowerManagement_Init();
[color=var(--ds-text-subtlest, #505F79)  !important]2
[color=var(--ds-text-subtlest, #505F79)  !important]3
    if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
[color=var(--ds-text-subtlest, #505F79)  !important]4
    {
[color=var(--ds-text-subtlest, #505F79)  !important]5
        USER_LOG_ERROR("could not init, error code: 0x%08X", returnCode);
[color=var(--ds-text-subtlest, #505F79)  !important]6
        return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
[color=var(--ds-text-subtlest, #505F79)  !important]7
    }
[color=var(--ds-text-subtlest, #505F79)  !important]8
[color=var(--ds-text-subtlest, #505F79)  !important]9
    auto callback_val = [](E_DjiPowerManagementPinState pinState) -> T_DjiReturnCode
[color=var(--ds-text-subtlest, #505F79)  !important]10
    {
[color=var(--ds-text-subtlest, #505F79)  !important]11
        std::cout << "Got pin state from callback " << pinState << "\n";
[color=var(--ds-text-subtlest, #505F79)  !important]12
        return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
[color=var(--ds-text-subtlest, #505F79)  !important]13
    };
[color=var(--ds-text-subtlest, #505F79)  !important]14
[color=var(--ds-text-subtlest, #505F79)  !important]15
    DjiPowerManagement_RegWriteHighPowerApplyPinCallback(callback_val);
[color=var(--ds-text-subtlest, #505F79)  !important]16
[color=var(--ds-text-subtlest, #505F79)  !important]17
    returnCode = DjiPowerManagement_ApplyHighPowerSync();
[color=var(--ds-text-subtlest, #505F79)  !important]18
    if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
[color=var(--ds-text-subtlest, #505F79)  !important]19
    {
[color=var(--ds-text-subtlest, #505F79)  !important]20
        USER_LOG_ERROR(
[color=var(--ds-text-subtlest, #505F79)  !important]21
            "setting high power mode failed, error code: 0x%08X", returnCode
[color=var(--ds-text-subtlest, #505F79)  !important]22
        );
[color=var(--ds-text-subtlest, #505F79)  !important]23
        return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
[color=var(--ds-text-subtlest, #505F79)  !important]24
    }


This will run with no errors, but it does not change the voltage of the pin. I also ran the power mode change application:
```
| Start power management sample - you will see notification when aircraft power off            |

```
But this has the function to change the power mode with:

static T_DjiReturnCode DjiTest_WriteHighPowerApplyPin(E_DjiPowerManagementPinState pinState)
[color=var(--ds-text-subtlest, #505F79)  !important]2
{
[color=var(--ds-text-subtlest, #505F79)  !important]3
    //attention: please pull up the HWPR pin state by hardware.
[color=var(--ds-text-subtlest, #505F79)  !important]4
    return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
[color=var(--ds-text-subtlest, #505F79)  !important]5
}


How are we supposed to enable high power mode? How do we pull up the HWPR pin?
2023-2-12
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules