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

nrf5280 re-config TRACEDATA pin as general gpio for pulse generation

hello Nordic

i am using nrf52840, sdk 16.0, working base on the peripheral app_ble_blinky example

i wish to use the p0_11 pin for pulse generation (not pwm), but when i try to config that pin as nrf_drv_gpiote_out_init(), i get err_code = 8 (NRF_ERROR_INVALID_STATE )

i looked into the data sheet and the forum for a bit and understood this is TRACEDATA2 pin but that it can also be configured as gpio, so the question is how to reconfigure it as gpiote (timer will generate a pulse with ppi to this pin) ?

also, since i understood the TRACEDATA has something to do with debugging, does configuring the pin as gpiote will have any affect on debugging with development board or in the future with a programmer via j-link connection to a PCB to be ?

also, i am using TRACDATA 1 (p0_12) as MOSI pin in an SPI comm and i did not get any problem there, so why is there a difference ?

best regard

Ziv

Parents Reply
  • hi Vidar

    the problem is that if i change setting in the pca10056.h file then it will be changed for all other projects using that board, same if i add another custom board since i allready have one 

    #elif defined(BOARD_CUSTOM)
      #include "bl652_sa_01.h"
      #include "audio_sticker.h"
    #else
    #error "Board is not defined"
    

    i have 2 includes there

    is there a way to corelate a specific board.h for each project ?

    hope to read from you soon

    best regards

    Ziv

Children
  • Hi Ziv,

    You can just change the LEDBUTTON_BUTTON assigment in main.c to a different button.

    Best regards,

    Vidar

  • hi Vidar

    well i actually solved it differently eventually, changed the boards.h file like so:

    elif defined (BOARD_D52DK1)
      #include "d52_starterkit.h"
    #elif defined (BOARD_ARDUINO_PRIMO)
      #include "arduino_primo.h"
    #elif defined (CUSTOM_BOARD_INC)
      #include STRINGIFY(CUSTOM_BOARD_INC.h)
    #elif defined(REDENT_NOVA_BOARD)
      #include "bl652_sa_01.h"
    #elif defined(AUDIO_STICKER_BOARD)
      #include "audio_sticker.h"
    #else
    #error "Board is not defined"
    

    if you think it might cause some problems please inform

    Best regards

    Ziv

  • Hi Ziv,

    It's perfectly ok to change board file as well. I don't see any problem with it.

    Best regards,

    Vidar

  • hi Vidar

    unfortunately my problems did not finish with this pin 

    i had in my code the "button_init()" function left from the 'app_ble_blinky' example, when i comment it then for some reason when trying to config that pin (p0_11) i get an error 'NRFX_ERROR_INVALID_STATE' here:

    nrfx_err_t nrfx_gpiote_out_init(nrfx_gpiote_pin_t                pin,
                                    nrfx_gpiote_out_config_t const * p_config)
    {
        NRFX_ASSERT(pin < NUMBER_OF_PINS);
        NRFX_ASSERT(m_cb.state == NRFX_DRV_STATE_INITIALIZED);
        NRFX_ASSERT(p_config);
    
        nrfx_err_t err_code = NRFX_SUCCESS;
    
        if (pin_in_use(pin))
        {
            err_code = NRFX_ERROR_INVALID_STATE;
        }

    my pin configuration looks like that:

     // init pin task for ppi use:
        nrf_drv_gpiote_out_config_t pin_toggle_config = GPIOTE_CONFIG_OUT_TASK_TOGGLE(false);
        err_code = nrf_drv_gpiote_out_init(HYDRATION_FREQ_OUTPUT_PIN, &pin_toggle_config);
        APP_ERROR_CHECK(err_code);

    any idea what i am doing wrong ?

    in the "custom_board.h" file i commented all the build in defines with that pin

    hope to read from you soon

    best regards

    Ziv

  • Hi Ziv,

    The GPIOTE module must be initialized first with nrf_drv_gpiote_init() before you can assign the pin with nrfx_gpiote_out_init(). Have you done that?

    Best regards,

    Vidar

Related