Hello All,
I am working on nRF52840 DV-kit, using SDK - nRF5_SDK_for_Thread_and_Zigbee_v3.0.0_d310e71
I am trying to create .c and .h file in my project for gpio_configuration,
Attached are the .c and .h file for gpio configuration, If I call the function in main() file then I am getting lots of error.
Errors are attached below, I am not understanding why such error, I have included all the related file also.
Rebuilding ‘uart_pca10056’ from solution ‘uart_pca10056’ in configuration ‘Release’
Generating linker script ‘uart_pca10056.ld’
Linking uart_pca10056.elf
Output/uart_pca10056 Release/Obj/gpio_config.o: in function `ulp_input_pin_configuration':
undefined reference to `nrfx_gpiote_in_uninit'
D:\Project\Eurotronics\Zigbee_Radiator\nRF5_SDK_for_Thread_and_Zigbee_v3.0.0_d310e71\examples\peripheral\uart _Exercise20210513\pca10056\blank\ses/gpio_config.c:103: undefined reference to `nrfx_gpiote_is_init'
D:\Project\Eurotronics\Zigbee_Radiator\nRF5_SDK_for_Thread_and_Zigbee_v3.0.0_d310e71\examples\peripheral\uart _Exercise20210513\pca10056\blank\ses/gpio_config.c:105: undefined reference to `nrfx_gpiote_init'
D:\Project\Eurotronics\Zigbee_Radiator\nRF5_SDK_for_Thread_and_Zigbee_v3.0.0_d310e71\examples\peripheral\uart _Exercise20210513\pca10056\blank\ses/gpio_config.c:111: undefined reference to `nrfx_gpiote_in_init'
D:\Project\Eurotronics\Zigbee_Radiator\nRF5_SDK_for_Thread_and_Zigbee_v3.0.0_d310e71\examples\peripheral\uart _Exercise20210513\pca10056\blank\ses/gpio_config.c:114: undefined reference to `nrfx_gpiote_in_event_enable'
Output/uart_pca10056 Release/Obj/gpio_config.o: in function `ulp_output_pin_configuration':
undefined reference to `nrfx_gpiote_in_uninit'
D:\Project\Eurotronics\Zigbee_Radiator\nRF5_SDK_for_Thread_and_Zigbee_v3.0.0_d310e71\examples\peripheral\uart _Exercise20210513\pca10056\blank\ses/gpio_config.c:126: undefined reference to `nrfx_gpiote_is_init'
D:\Project\Eurotronics\Zigbee_Radiator\nRF5_SDK_for_Thread_and_Zigbee_v3.0.0_d310e71\examples\peripheral\uart _Exercise20210513\pca10056\blank\ses/gpio_config.c:128: undefined reference to `nrfx_gpiote_init'
D:\Project\Eurotronics\Zigbee_Radiator\nRF5_SDK_for_Thread_and_Zigbee_v3.0.0_d310e71\examples\peripheral\uart _Exercise20210513\pca10056\blank\ses/gpio_config.c:133: undefined reference to `nrfx_gpiote_out_init'
Output/uart_pca10056 Release/Obj/gpio_config.o: in function `ulp_in_pin_handler':
undefined reference to `nrfx_gpiote_clr_task_trigger'
Build failed
main.c file snippet,
/**
* @brief Function for main application entry.
*/
int main(void)
{
uint32_t err_code;
bsp_board_init(BSP_INIT_LEDS);
ulp_input_pin_configuration();
while(1)
{
}
}
gpio_config.c and .h file,
/******************************************************************************
gpio_config.c - nRF52840 GPIO configration API Source file
Version: 0.9.1
Created on: 07/04/2021
Created by: Rohit Rajapure
Copyright (c) 2017 Shalaka Connected Devices LLP. All rights reserved.
Software License Agreement
Redistribution and use in source and binary forms, with or without
modification, are not permitted.
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the
distribution.
Neither the name of Shalaka Connected Devices LLP nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "string.h"
#include "app_error.h"
#include "nrf_delay.h"
#include "nrf.h"
#include "bsp.h"
#include "nrf_drv_gpiote.h"
#include "nordic_common.h"
#include "sdk_errors.h"
#include "gpio_config.h"
/******************************************************************************************
*TASK HANDLES
*
*******************************************************************************************/
/******************************************************************************************
*GLOBAL VARIABLES
*
*******************************************************************************************/
bool boolULP_Pin_Transaction = false;
/******************************************************************************************
*EXTERNAL VARIABLES
*
*******************************************************************************************/
/******************************************************************************************
*FUNCTIONS
*
*******************************************************************************************/
/******************************************************************************************
*ULP pin communication transaction task function
*
*******************************************************************************************/
/******************************************************************************************
*ULP pin interrupt handling routine
*
*******************************************************************************************/
void ulp_in_pin_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
nrf_drv_gpiote_clr_task_trigger(ULP_PIN); //clear task
ulp_output_pin_configuration(); //configure ULP pin as output pin
nrf_gpio_pin_write(ULP_PIN,1); //set high ULP pin for 5msec
nrf_delay_ms(5); //give 5msec delay to communicate with host controller
ulp_input_pin_configuration(); //after communication 5msec time is over set ULP pin as input again
}
/******************************************************************************************
*ULP pin configuration as input pin function
*return void
*******************************************************************************************/
void ulp_input_pin_configuration(void)
{
uint32_t err_code;
nrf_drv_gpiote_in_uninit(ULP_PIN); //disable ULP pin as input pin
if(!nrf_drv_gpiote_is_init())
{
err_code = nrf_drv_gpiote_init();
}
nrf_drv_gpiote_in_config_t ulp_in_config = GPIOTE_CONFIG_IN_SENSE_HITOLO(true);
ulp_in_config.pull = NRF_GPIO_PIN_PULLDOWN;
err_code = nrf_drv_gpiote_in_init(ULP_PIN, &ulp_in_config, ulp_in_pin_handler);
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_event_enable(ULP_PIN, true);
}
/******************************************************************************************
*ULP pin configuration as output pin function
*return void
*******************************************************************************************/
void ulp_output_pin_configuration(void)
{
uint32_t err_code;
nrf_drv_gpiote_in_uninit(ULP_PIN); //disable ULP pin as input pin
if(!nrf_drv_gpiote_is_init())
{
err_code = nrf_drv_gpiote_init();
}
nrf_drv_gpiote_out_config_t ulp_out_config = GPIOTE_CONFIG_OUT_SIMPLE(false);
err_code = nrf_drv_gpiote_out_init(ULP_PIN, &ulp_out_config);
APP_ERROR_CHECK(err_code);
}
Let me know what is wrong here.
Thanks and Regards
Rohit R