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

UARTE Configuration with HAL library, multiple definition UARTE0_UART0_IRQHandler

Hi all, 

I'm struggling with UARTE and easyDMA. i just want to send data with TX.

I am trying to configure it with the hal librairy but i cannot manage to make it work. Either, my code compile and run but nothing is sent, either it is not compiling and i have this error : 

"multiple definition of `UARTE0_UART0_IRQHandler'; Output/receiver_pca10040 Release/Obj/nrfx_prs.o:../.nrfsdk/modules/nrfx/drivers/src/prs/nrfx_prs.c:81: first defined here"

I am using SDK 15 without softdevice, on nRF52832

Here is my functions to configure the UARTE peripheral : 

#include "nrf_uarte.h"

void uarte_set_param(NRF_UARTE_Type *p_UARTE, TS_CONN_PARAM lts_conn_param){
  nrf_uarte_disable(p_UARTE);                           //disable it to configure
  
  nrf_gpio_pin_set(lts_conn_param.ul_tx_pin_no);
  nrf_gpio_cfg_output(lts_conn_param.ul_tx_pin_no);
  nrf_gpio_cfg_input(lts_conn_param.ul_rx_pin_no, NRF_GPIO_PIN_NOPULL);
  nrf_uarte_txrx_pins_set(p_UARTE, lts_conn_param.ul_tx_pin_no, lts_conn_param.ul_rx_pin_no);
  
  if (lts_conn_param.flow_control == NRF_UARTE_HWFC_ENABLED){
    nrf_gpio_cfg_input(lts_conn_param.ul_pin_cts_no, GPIO_PIN_CNF_PULL_Pulldown);
    nrf_gpio_cfg_input(lts_conn_param.ul_pin_rts_no, GPIO_PIN_CNF_PULL_Pulldown);
    nrf_uarte_hwfc_pins_set(p_UARTE, lts_conn_param.ul_pin_rts_no, lts_conn_param.ul_pin_cts_no);  
  } else {
    nrf_uarte_hwfc_pins_disconnect(p_UARTE);
  }
  
  nrf_uarte_baudrate_set(p_UARTE, lts_conn_param.baud_rate);
  nrf_uarte_configure(p_UARTE, lts_conn_param.use_parity, lts_conn_param.flow_control);
  
  nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ENDRX);
  nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ENDTX);
  nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_RXSTARTED);
  nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_TXSTARTED);
  nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_CTS);
  nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_TXSTOPPED);
  nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ERROR);
  nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_RXTO);
  
  nrf_uarte_int_enable(p_UARTE, NRF_UARTE_INT_ENDTX_MASK | NRF_UARTE_INT_ERROR_MASK);
  NVIC_ClearPendingIRQ(UARTE0_UART0_IRQn);
  NVIC_SetPriority(UARTE0_UART0_IRQn, 4);
  NVIC_EnableIRQ(UARTE0_UART0_IRQn);
  
}


void uarte_disconnect_pins(NRF_UARTE_Type *p_UARTE){
  nrf_uarte_txrx_pins_disconnect(p_UARTE);
  nrf_uarte_hwfc_pins_disconnect(p_UARTE);
}


void uarte_enable(NRF_UARTE_Type *p_UARTE){
  nrf_uarte_enable(p_UARTE);
}


void uarte_disable(NRF_UARTE_Type *p_UARTE){
  nrf_uarte_disable(p_UARTE);
}


void uarte_start_TX(NRF_UARTE_Type *p_UARTE, uint8_t const *p_buf, uint32_t size){
  nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ENDRX);
  nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ENDTX);
  nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_RXSTARTED);
  nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_TXSTARTED);
  nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_CTS);
  nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_TXSTOPPED);
  nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ERROR);
  nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_RXTO);

  rubb_TXing=true;
  nrf_uarte_tx_buffer_set(p_UARTE, p_buf, size); 
  nrf_uarte_task_trigger(p_UARTE, p_UARTE->TASKS_STARTTX);
}



void UARTE0_UART0_IRQHandler(void){

  if (nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_ERROR))
  {
    nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ERROR);
    printf("Error: UARTE ERROR\n");
  }

  if (nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_ENDTX))
  {
    nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ENDTX);   
    rubb_TXing=false;
  }
}

I use it like this in my main c file 

static uint8_t luab_test[7];

const TS_CONN_PARAM lts_conn_param = { NRF_UARTE_PSEL_DISCONNECTED,
                                        19,
                                        NRF_UARTE_PSEL_DISCONNECTED, 
                                        NRF_UARTE_PSEL_DISCONNECTED, 
                                        NRF_UARTE_HWFC_DISABLED, 
                                        NRF_UARTE_PARITY_EXCLUDED,
                                        NRF_UARTE_BAUDRATE_115200,
                                       };

uarte_set_param(NRF_UARTE0, lts_conn_param);
uarte_enable(NRF_UARTE0);
uarte_start_TX(NRF_UARTE0, luab_test, sizeof(luab_test));

Hope someone has a hint about this!

Thank you all in advance for your help

Parents Reply Children
No Data
Related