ADC low level driver on TWR-KW24D512

cancel
Showing results for 
Search instead for 
Did you mean: 

ADC low level driver on TWR-KW24D512

956 Views
fabricetocci
Contributor III

Hi,

I want to migrate from MC1322x to KW24D512

My zigbee solution supports several sensors through I2C, UART interfaces or compute measurements from ADC HW modules.

On MC1322x projects, I can find AppToMC1322xADC.c and AppToMC1322xADC.h files in BeeApps folder and ADC_Interface.h in PLM/LibInterface folder

Looking to code generated with BeeKit, I haven't found any ADC low level driver in KW24D512 projects?.

What are the solutions to manage ADC HW modules on KW24D512?

How can I access to low level driver?

Regards.

Fabrice.

0 Kudos
3 Replies

376 Views
AngelC
Senior Contributor I

Dear Fabrice,

You could download the Kinetis SDK for K21 and KW2x devices. There you will find some examples of ADC module usage. You may use those examples as reference for your project.

Link: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=TWR-K21D50M&fpsp=1&tab=Design_Tools_T...

Regards,

AngelC

0 Kudos

376 Views
fabricetocci
Contributor III

Hi AngelC,

I have followed your advices.

From KSDK1.1.0_K21DA_KW24D_1.0.0

I started from adc_low_power demo

I used the code from adc_low_power.c, only the ADC part not the low power (not needed for this first step)

Here are the functions I use

void calibrateParams(void);

void ADC_TEST_InstallCallback(uint32_t instance, uint32_t chnGroup, void (*callbackFunc)(void) )

uint16_t ADC_TEST_GetConvValueRAWInt(uint32_t instance, uint32_t chnGroup)

void ADC1IRQHandler(void)

static int32_t init_adc(uint32_t instance)

int32_t GetCurrentTempValue(void)

I have added few files in PLM/Interface to compile the project without error.

fsl_adc16_driver.h

fsl_adc16_hal.h

fsl_pmc_hal.h

With this, the Link fails with the following errors:

Linking

Error[Li005]: no definition for "ADC16_DRV_GetAutoCalibrationParam" [referenced from C:\Data\Fabrice\Kinetis\KW24D512\

Work_Space\Kinetis_switch_Badge_23_07_2014_v1_1430A\HaOnOffSwitch\Debug\Obj\BeeApp.o]

Error[Li005]: no definition for "ADC16_DRV_SetCalibrationParam" [referenced from C:\Data\Fabrice\Kinetis\KW24D512\

Work_Space\Kinetis_switch_Badge_23_07_2014_v1_1430A\HaOnOffSwitch\Debug\Obj\BeeApp.o]

Error[Li005]: no definition for "ADC16_DRV_StructInitUserConfigDefault" [referenced from C:\Data\Fabrice\Kinetis\KW24D512\

Work_Space\Kinetis_switch_Badge_23_07_2014_v1_1430A\HaOnOffSwitch\Debug\Obj\BeeApp.o]

Error[Li005]: no definition for "ADC16_DRV_Init" [referenced from C:\Data\Fabrice\Kinetis\KW24D512\Work_Space\

Kinetis_switch_Badge_23_07_2014_v1_1430A\HaOnOffSwitch\Debug\Obj\BeeApp.o]

Error[Li005]: no definition for "ADC16_DRV_ConfigConvChn" [referenced from C:\Data\Fabrice\Kinetis\KW24D512\Work_Space\

Kinetis_switch_Badge_23_07_2014_v1_1430A\HaOnOffSwitch\Debug\Obj\BeeApp.o]

Error[Li005]: no definition for "ADC16_DRV_EnableHwAverage" [referenced from C:\Data\Fabrice\Kinetis\KW24D512\Work_Space\

Kinetis_switch_Badge_23_07_2014_v1_1430A\HaOnOffSwitch\Debug\Obj\BeeApp.o]

Error[Li005]: no definition for "ADC16_DRV_WaitConvDone" [referenced from C:\Data\Fabrice\Kinetis\KW24D512\Work_Space\

Kinetis_switch_Badge_23_07_2014_v1_1430A\HaOnOffSwitch\Debug\Obj\BeeApp.o]

Error[Li005]: no definition for "ADC16_DRV_GetConvValueRAW" [referenced from C:\Data\Fabrice\Kinetis\KW24D512\Work_Space\

Kinetis_switch_Badge_23_07_2014_v1_1430A\HaOnOffSwitch\Debug\Obj\BeeApp.o]

Error[Li005]: no definition for "ADC16_DRV_ConvRAWData" [referenced from C:\Data\Fabrice\Kinetis\KW24D512\Work_Space\

Kinetis_switch_Badge_23_07_2014_v1_1430A\HaOnOffSwitch\Debug\Obj\BeeApp.o]

Error[Li005]: no definition for "ADC16_DRV_PauseConv" [referenced from C:\Data\Fabrice\Kinetis\KW24D512\Work_Space\

Kinetis_switch_Badge_23_07_2014_v1_1430A\HaOnOffSwitch\Debug\Obj\BeeApp.o]

Error[Li005]: no definition for "ADC16_DRV_DisableHwAverage" [referenced from C:\Data\Fabrice\Kinetis\KW24D512\Work_Space\

Kinetis_switch_Badge_23_07_2014_v1_1430A\HaOnOffSwitch\Debug\Obj\BeeApp.o]

Error while running Linker

Total number of errors: 11

Total number of warnings: 6

Looking to those errors I suspected to have missed a library.

Browsing into KSDK1.1.0_K21DA_KW24D_1.0.0 for the missed function call, I saw the file libksdk_platform.a .

I added it in the PLM lib lists and the linker comes out with another error:

Linking

Error[Li005]: no definition for "__write" [referenced from putchar.o(dl7M_tln.a)]

Error while running Linker

Total number of errors: 1

Total number of warnings: 6

Questions:

Am I correct in my ADC  integration process?

What can I do to solve the Linker errors?

Hope you will help.

Best regards.

Fabrice.

0 Kudos

376 Views
AngelC
Senior Contributor I

Dear Fabrice,

Please notice you may use these functions as reference only. One thing you could do is to manually migrate the functions to the KW2x project and re-name any typedefs, variables or definitions as expected by the KW2x project. In this way you will not have to import or add any extra files and avoid these issues. 

You may also try to add the imported files’ path to the preprocessor properties in Project->Options->C/C++ Compiler->Preprocessor. Please let me know your results.

Regards,

AngelC

0 Kudos