This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Radio Test software modification: need to create a new command option for CLI

Hello, I'm using the Radio Test software (SDK 15.2) to control the N52840 radio IC. Our circuit design requires the use of an external RF amplifier IC. Our software puts the external amplifier IC into different modes using 5 different GPIOs on the N52840 radio. The trouble is that in order to pass regulatory requirements we need to configure Radio Test software to also control these same GPIOs, to control the RF amplifier.

How do I go about creating a new command line option, like one listed in blue when entering 'Tab' in Radio Test? I suppose the new option could be called 'radio_config' and have 5 different configuration options. It could function similar to the 'data_rate' option (see attached pic). It would need 5 menu choices  to set the appropriate GPIOs on the Nordic IC. I've looked over the Radio Test code (using Segger Embedded Studio IDE) and I'm not sure where to start.

Thanks

Parents
  • Hello,

    I see that you are currently looking at the radio_test application.

    IF you look in the file radio_cmd.c, you can see a bunch of calls to NRF_CLI_CMD_REGISTER(), such as:

    NRF_CLI_CMD_REGISTER(data_rate, &m_sub_data_rate, "Set data rate <sub_cmd>", cmd_data_rate_set);

    In this call:

    data_rate is the name of the command (the one you see in blue).
    m_sub_data_rate is where the second parameter is stored.
    "Set data rate" is what appears if you write "data_rate --help".
    cmd_data_rate_set is the callback function.

    Since this command takes two variables, there is a sub command. This is linked to the data_rate_command by the function:

    NRF_CLI_CREATE_STATIC_SUBCMD_SET(m_sub_data_rate)

    which basically registers the different options. Let us look at one of them:

    NRF_CLI_CMD(nrf_1Mbit, NULL, "1 Mbit/s Nordic proprietary radio mode", cmd_nrf_1mbit),

    nRF_1Mbit is the command that is entered (which will be shown in blue when you tab).
    NULL is a pointer to the next subcommand (which doesn't exist in this case).
    "1 Mbit/s Nordic proprietary radio mode" is the help text.
    cmd_nrf_1mbit is the callback function that is called when the main and this sub command is called together.

    So if you set up your radio_config similar to this, you will have a new set of commands with callbacks that you can use.

    Best regards,

    Edvin

Reply
  • Hello,

    I see that you are currently looking at the radio_test application.

    IF you look in the file radio_cmd.c, you can see a bunch of calls to NRF_CLI_CMD_REGISTER(), such as:

    NRF_CLI_CMD_REGISTER(data_rate, &m_sub_data_rate, "Set data rate <sub_cmd>", cmd_data_rate_set);

    In this call:

    data_rate is the name of the command (the one you see in blue).
    m_sub_data_rate is where the second parameter is stored.
    "Set data rate" is what appears if you write "data_rate --help".
    cmd_data_rate_set is the callback function.

    Since this command takes two variables, there is a sub command. This is linked to the data_rate_command by the function:

    NRF_CLI_CREATE_STATIC_SUBCMD_SET(m_sub_data_rate)

    which basically registers the different options. Let us look at one of them:

    NRF_CLI_CMD(nrf_1Mbit, NULL, "1 Mbit/s Nordic proprietary radio mode", cmd_nrf_1mbit),

    nRF_1Mbit is the command that is entered (which will be shown in blue when you tab).
    NULL is a pointer to the next subcommand (which doesn't exist in this case).
    "1 Mbit/s Nordic proprietary radio mode" is the help text.
    cmd_nrf_1mbit is the callback function that is called when the main and this sub command is called together.

    So if you set up your radio_config similar to this, you will have a new set of commands with callbacks that you can use.

    Best regards,

    Edvin

Children
Related