i2d_nss_example_1 -- Error : undefined reference to 'current native'

cancel
Showing results for 
Search instead for 
Did you mean: 

i2d_nss_example_1 -- Error : undefined reference to 'current native'

Jump to solution
142 Views
Contributor III

I want to measure resistance using NHS3152 ADK, I have connected my resistor between ANA0 and ANA4.

I am trying to run i2d_nss_example_1, however i am getting undefined reference to 'current native' error. How do i fix this? 

Also, is there a way to display the variables in the variable tab of LPCXpresso? for now they wont show up. 

This is the code: 

#include "board.h"

extern volatile int current_native;
extern volatile int current_picoampere;

void i2d_nss_example_1(void)
{
//! [i2d_nss_example_1]
int i2dValue;
int i2dNativeValue;
Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_ANA0_4, IOCON_FUNC_1); /* Set pin function to analog */
Chip_I2D_Init(NSS_I2D);
Chip_I2D_Setup(NSS_I2D, I2D_SINGLE_SHOT, I2D_SCALER_GAIN_10_1, I2D_CONVERTER_GAIN_HIGH, 100);
Chip_I2D_SetMuxInput(NSS_I2D, I2D_INPUT_ANA0_4);
Chip_I2D_Start(NSS_I2D);
while (!(Chip_I2D_ReadStatus(NSS_I2D) & I2D_STATUS_CONVERSION_DONE)) {
; /* wait */
}
i2dNativeValue = Chip_I2D_GetValue(NSS_I2D);
i2dValue = Chip_I2D_NativeToPicoAmpere(i2dNativeValue, I2D_SCALER_GAIN_10_1, I2D_CONVERTER_GAIN_HIGH, 100);
Chip_I2D_DeInit(NSS_I2D);
//! [i2d_nss_example_1]

current_native = i2dNativeValue;
current_picoampere = i2dValue;
}

int main(void)
{
Board_Init();
i2d_nss_example_1();


}

Tags (3)
1 Solution
67 Views
NXP Employee
NXP Employee

Hi,

(See also my explanation on https://community.nxp.com/message/1333472?commentID=1333472). Have a look at the documentation <SDK>/docs/firmware.html > Documentation of the low-level HW block drivers > i2d: Current to Digital converter driver > Example 1 - Single shot conversion with polling. Copy the listed code there to your own project, inside a function in your project.

The error you are receiving now is due to the "C sugar" added to be able to verify the example code: in our test lab, we include this example in a test which does define a variable current_native. There the code links fine. The folder example_snippets with all the files and code is added to the SDK as a convenience to have all example code on one place, which you can find in your IDE and copy as regular code. It is not meant to be used as is; these are not ready-made projects which you can execute instantly. The code snippets are guaranteed to be functional and do something sensible, but are not big enough to warrant a full project overhead for each of them.

KR,
Dries.

View solution in original post

2 Replies
68 Views
NXP Employee
NXP Employee

Hi,

(See also my explanation on https://community.nxp.com/message/1333472?commentID=1333472). Have a look at the documentation <SDK>/docs/firmware.html > Documentation of the low-level HW block drivers > i2d: Current to Digital converter driver > Example 1 - Single shot conversion with polling. Copy the listed code there to your own project, inside a function in your project.

The error you are receiving now is due to the "C sugar" added to be able to verify the example code: in our test lab, we include this example in a test which does define a variable current_native. There the code links fine. The folder example_snippets with all the files and code is added to the SDK as a convenience to have all example code on one place, which you can find in your IDE and copy as regular code. It is not meant to be used as is; these are not ready-made projects which you can execute instantly. The code snippets are guaranteed to be functional and do something sensible, but are not big enough to warrant a full project overhead for each of them.

KR,
Dries.

View solution in original post

67 Views
NXP TechSupport
NXP TechSupport

Hello,


Could you please help with an screenshot of the problem ?

Regards,
Estephania

0 Kudos