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

Can I configure GPIOTE to debug my signals?

Hello,

I am using nrf52832 DK and I would like to use the GPIOs port to debug a couple of signals that I genereate within the MCU.

So far I have configured my GPIOTE module like this (I am using the LEDs for now as example to see that they change), but I am not sure how if I have to configure the GPIOTE more in order to make my signal available on that pin.

My definition

#define GPIO_OUTPUT_A  BSP_LED_0 //25  /**< Pin number for A signal debug. */

My GPIOTE config

static void gpiote_init(void){

    uint32_t            err_code;
    nrf_drv_gpiote_out_config_t config = GPIOTE_CONFIG_OUT_SIMPLE(NRF_GPIOTE_INITIAL_VALUE_LOW);
    
    //Configuring A debug pin
    err_code = nrf_drv_gpiote_out_init(GPIO_OUTPUT_A, &config);
    APP_ERROR_CHECK(err_code);

    if (!nrf_drv_gpiote_is_init())
    {
        err_code = nrf_drv_gpiote_init();
        APP_ERROR_CHECK(err_code);
    }
}

So if I would like to have the value of A,define as float for instance, how can I write it to the GPIO_OUTPUT_A ? Something like this

nrf_gpio_pin_write(GPIO_OUTPUT_A,(uint32_t)A);

Thanks in advance

  • Are you sure you are using right module? GPIOTE (as shortcut suggests) means General Purpose IO Tasks and Events, how you would like to utilize it for debug? You can either signal something with GPIO pulses (simple setting digital LOW/HIGH values on PINs you like), that has nothing to do with Task and Event functionality (that's useful if you want to detect some GPIO input change (= that's Event part) and do some action upon this trigger (= that's the Task part)).

    But simple GPIO low/high won't output any "value" (not speaking about "float" type;))) unless you design some protocol on top of simple digital GPIO (low/high values). Serial data output over UART is typical example but you can use other things like SEGGER RTT... then again question is why you don't use these logging/debugging modules built into Nordic SDK examples and bother with GPIO(TE)???

  • @endnode, thanks for your clarification. I would like to have at least one of the signal(that varies between 1/0) out to check how it since I will eventually use it for toggling orther device. Couldn't I even in that case set the signals out the pins?

  • Sure, i use that for signalling with LEDs or just for reading with Logical analyzer/oscilloscope as well. There are all functions available in \components\drivers_nrf\hal\nrf_gpio.h header file (first configure the PIN as output and then use set/clear functions to set it LOW or HIGH.) There are also HAL and blinky examples in nRF5 SDK, have you searched any?

  • @endnode thanks again, I take a look to the blinky example and GPIOTE example. Is HAL example also relevant for the GPIO? I cannot find any example of HAL on SDK12.2, where can I find that?

  • HAL means Hardware Abstraction Layer, typically the lowest layer of any C/C++ API or SDK. Basically every driver is using it. I would say slow down, take blinky example, you wanted to blink with LEDs so spend some time with it until you are sure what are you doing.

Related