Hi Matthew,
Please look at the LcdDriver.c file that you could find in the SDK.
C:\NXP\bstudio_nxp\sdk\JN-SW-4170\Platform\DK4\Source
vAHI_ApConfigure(E_AHI_AP_REGULATOR_ENABLE,
E_AHI_AP_INT_DISABLE,
E_AHI_AP_SAMPLE_8,
E_AHI_AP_CLOCKDIV_500KHZ,
E_AHI_AP_INTREF);
while (!bAHI_APRegulatorEnabled()); /* spin on reg not enabled */
vAHI_AdcEnable(E_AHI_ADC_SINGLE_SHOT, E_AHI_AP_INPUT_RANGE_2, E_AHI_ADC_SRC_VOLT); //enable adc
vAHI_AdcStartSample(); // start sampling adc
while(bAHI_AdcPoll()); // keep polling until we get a value
u16BattVoltage = 0;
Hope it helps.
Regards,
Mario
Hi Mario,
Thank you for the info.
I have created a *.c file & *.h file based on what i need from the example code you told me to look at. There were a few errors that it brought up but ironed out most of them. There is an error that i seem to not be able to sort out.
Error code: -
symbol(s) not found for architecture x86_64
What does this mean?
Any help much appreciated
Regards
Matt
Hi Matthew,
Did you add your c file in the makefile?
For example
###############################################################################
# Application Source files
# Note: Path to source file is found using vpath below, so only .c filename is required
APPSRC = app_main.c
What is the error that the console log is showing?
Regards,
Mario
Hello Mario,
Thank you for the reply
The error that comes up is in the Problem Tab and it says:-
symbol(s) not found for architecture x86_64.
in the console log tab:-
08:38:47 **** Incremental Build of configuration Debug for project ADC1 ****
Info: Internal Builder is used for build
gcc -o binADC1 ADC1.o
Undefined symbols for architecture x86_64:
"_bAHI_APRegulatorEnabled", referenced from:
_u8LcdCalcContrastLevel in ADC1.o
"_bAHI_AdcPoll", referenced from:
_u8LcdCalcContrastLevel in ADC1.o
"_main", referenced from:
implicit entry/start for main executable
"_u16AHI_AdcRead", referenced from:
_u8LcdCalcContrastLevel in ADC1.o
"_u32AHI_Init", referenced from:
_u8LcdCalcContrastLevel in ADC1.o
"_vAHI_AdcEnable", referenced from:
_u8LcdCalcContrastLevel in ADC1.o
"_vAHI_AdcStartSample", referenced from:
_u8LcdCalcContrastLevel in ADC1.o
"_vAHI_ApConfigure", referenced from:
_u8LcdCalcContrastLevel in ADC1.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
08:38:47 Build Failed. 1 errors, 0 warnings. (took 133ms)
It doesnt even make a Makefile.
I think i must be doing something wrong or missing something?
Regards
Matthew
Hi Matthew,
Did you include the #include "AppHardwareApi.h" in your c file?
Regards,
Mario
Hi Mario,
Yes i included "AppHardwareAPI.h" in my c file i also incuded:-
#include <jendefs.h>
#include "ADC2.h"
I included the below just to make sure it covered anything that i needed.
#include "AppHardwareApi_JN516x.h"
#include "AppHardwareApi_JN5169.h"
#include "PeripheralRegs.h"
#include "PeripheralRegs_JN516x.h"
#include "PeripheralRegs_JN5169.h"
Could it be down to that i dont have any symbols in the Properties of the project.
I am doing this on a Mac and using Eclipse. i have also done this on a Windows machine using Beyond Studio and that still doesnt put anything in the Symbols tab in properties.
This is the rest of my code: -
/*****************************************************************************
* Macro Definitions *
*****************************************************************************/
#define CHIP_ID_REG (0x6000b686) // CHIP_ID_REG for JN5169_Sensor1 Chip
//#define CHIP_ID_REG (0x6000b686) // CHIP_ID_REG for JN5169_Sensor2 Chip
//#define CHIP_ID_REG (0x6000b686) // CHIP_ID_REG for JN5169_Sensor3 Chip
//#define CHIP_ID_REG (0x6000b686) // CHIP_ID_REG for JN5169_Sensor4 Chip
//#define CHIP_ID_REG (0x6000b686) // CHIP_ID_REG for JN5169_Sensor5 Chip
//#define CHIP_ID_REG (0x6000b686) // CHIP_ID_REG for JN5169_Sensor6 Chip
//#define CHIP_ID_REG (0x6000b686) // CHIP_ID_REG for JN5169_Sensor7 Chip
//#define CHIP_ID_REG (0x6000b686) // CHIP_ID_REG for JN5169_Sensor8 Chip
//#define CHIP_ID_REG (0x6000b686) // CHIP_ID_REG for JN5169_Sensor9 Chip
//#define CHIP_ID_REG (0x6000b686) // CHIP_ID_REG for JN5169_Sensor10 Chip
/*****************************************************************************
*
* NAME: bPotEnable
*
* DESCRIPTION:
* Enables Potentiometer - configure JN516x IO and ADCs to enable readings
*
* RETURNS
* boot_t, success or failure.
*
****************************************************************************/
PUBLIC bool_t bPotEnable(void)
{
vAHI_ApConfigure(E_AHI_AP_REGULATOR_ENABLE,
E_AHI_AP_INT_DISABLE,
E_AHI_AP_SAMPLE_2,
E_AHI_AP_CLOCKDIV_500KHZ,
E_AHI_AP_INTREF);
#if (defined JENNIC_CHIP_FAMILY_JN514x) || (defined JENNIC_CHIP_FAMILY_JN516x)
vAHI_AdcEnable(E_AHI_ADC_SINGLE_SHOT,
E_AHI_AP_INPUT_RANGE_2,
E_AHI_ADC_SRC_ADC_1);
#endif
vAHI_AdcStartSample();
return TRUE;
}
/*****************************************************************************
*
* NAME: u16ReadPotValue
*
* DESCRIPTION:
* Reads the current potentiometer value
*
* RETURNS
* uint16, value from the ADC.
*
****************************************************************************/
PUBLIC uint16 u16ReadPotValue(void)
{
return (u16AHI_AdcRead());
}
/*****************************************************************************
*
* NAME: bPotDisable
*
* DESCRIPTION:
* Disables Potentiometer
*
* RETURNS
* boot_t, success or failure.
*
****************************************************************************/
PUBLIC bool_t bPotDisable(void)
{
vAHI_AdcDisable();
return TRUE;
}
/*****************************************************************************
* END OF FILE
*****************************************************************************/
Regards
Matthew
Hi Matthew,
The h file should be in your application source folder.
The make file should have defined the c file.
For Example, the ADC2.c file
#include <jendefs.h>
#include "AppHardwareApi.h"
#include "ZTimer.h"
#include "app_main.h"
#include "ADC2.h"
Makefile
APPSRC = ADC2.c
Please let me know your findings.
Regards,
Mario
HI Mario,
I have my *.h file in the source folder. in my makfile i have defined my *.c file.
I have managed to overcome the error that i was getting. i beleive it was down to the toolchain i was using.
On another note how would i go about coding to print the ADC value out into terminal on Beyond Studio once i have it enabled and also started to ADC sampling?
Want to see the values change from the potentiometer when i alter it left or right.
Regards
Matthew
Hi Matthew,
You could use the DBG Printf function, the first parameter should be TRUE.
u16ALSResult = u16TSL2550_ReadResult();
DBG_vPrintf(TRACE_LIGHT_TEMP_OCC_SENSOR,"\nResult = %d",u16ALSResult);
Hope it helps.
Regards,
Mario
Hi Mario,
Thank you for the reply. Managed to get the value to print out to terminal.
Thank you for all the help.
May call upon yourself again.
Reagrds
Matthew