This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ERROR L218E : how to solve it?

I am new to KEIL and start learning for an project. I have got the message error shown below : Error: L6218E: Undefined symbol ADC_RegularChannelConfig (referred from main_test_adc.o).

I searched about this error but I still don't know how to solve it. I am using uvision 4 and stm32f103rb processor and write a simple program using ADC.
Please help me if you encounter similar problem before. I really appreciate everyone's help. :)

  • It shouldn't matter if you are new to Keil.

    Your program wants to call a specific function, but your project doesn't contain any source file with the source code for that function. And the project doesn't contain an object file or library with a pre-compiled version of that function.

    So either you need to figure out why your program wants to use that function. Or you'll have to go searching for that function.

  • One adds STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_adc.c (or equivalent in your setup) to the project so it has the source to the function being called.

  • Thanks a lot but I still have another problem. I have added adc.c and rcc.c to my project file. It has solved the error I had before. But I got this new error plus a lot of warnings :

    ..\src\stm32f10x_rcc.c(1451): warning: #223-D: function "assert_param" declared implicitly

    .\new11_stm32Rb_new.axf: Error: L6218E: Undefined symbol assert_param (referred from stm32f10x_adc.o).

    I searched about it and I saw that "assert_param" is a macro function. I am not sure how and where to define this function. Or is there any other way to declare the ADC initialization ? I have used this code.

    ADC1->CR2 |= ADC_CR2_ADON | ADC_CR2_CONT; //turn on adc and enable continuous mode
    
    ADC_RegularChannelConfig(ADC1,0,1,ADC_SampleTime_239Cycles5); // config to use ADC1 channel 0,
                                                            first in sequence, sampling time
    
    ADC1->CR1 = ADC_CR1_EOCIE;             //Enable interrupt for end of conversion
    NVIC_EnableIRQ(ADC1_2_IRQn);           //Enable interrupt for ADC1
    ADC1->CR2 |= ADC_CR2_ADON;             //Turn on conversion
    

    I will use ADC interrupt and I found this program from some web and I try to write by myself. If you see any errors, please correct them.
    If you have some simple ADC program for stm32f10x, please share the links, too. Thank you :)

  • I've downloaded it just now. Thanks a lot. A lot of example files are inside the zip folder so I will take a look at them and practice first.
    There is no more error for my problem. I found the assert_param function at stm32f10x_conf.h and I include the header in the respective files.
    Thanks for helping me.
    Have a nice day!

  • I dont see the answer here.
    I have a Keil example file that shows
    stm32f4xx_conf.h listed under all of the source files in the tree.
    whish you could post print screens here
    There is no refernce to the file in any of the source code yet it is till included.
    This file seems to be maintained by the IDE like stdinit.h
    The problem is when you have an example written for IAR, This file does not include itself.
    I found stm32f10x_conf.h in c:\keil\arm\inc\.

    My question is, how to get it to include in all files automatically.

    I dont believe that editting all of the stperiph files is the answer.

  • Clearly it isn't, but you're not the OP either and he had a different linkage question.

    If you download one of the STM32F4 firmware libraries (DSP or Discovery, etc), you will find "template" projects for Keil

    The stm32f4xx_conf.h is normally resident in YOUR project directory, so you can modify it there. It is included via stm32f4xx.h when USE_STDPERIPH_DRIVER is defined within your project (preprocessor defines).

    The expectation for your project is that you also provide the compiler with a list of search paths for the include files, which will be something like
    .\..\
    .\..\..\..\Libraries\CMSIS\Include
    .\..\..\..\Libraries\CMSIS\Device\ST\STM32F4xx\Include
    .\..\..\..\Libraries\STM32F4xx_StdPeriph_Driver\inc
    .\..\..\..\Utilities\STM32F401-Discovery

    You really don't want the files Keil included unless you're building one of their Blinky examples from \ARM\Boards\ST type directories.

    If you need to localize the startup file, then you'd copy startup_stm32f4xx.s (or equivalent) into your own project directory.