cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX + NUCLEO-L053R8 + X-CUBE-MEMS1 can't be built

Mario Simunic
Associate III

Using CubeMX v5.0 and FW_L0_v1.11.0 I'm generating new project from scratch.

Project has initialized (using HAL) UART2, I2C1 (on alternate pins PB8, PB9), GPIOs, EXTIs and clock. UART2, I2C1 and EXTI interrupts are enabled and IRQ handlers generated by the CubeMX.

On top of that there is X-CUBE-MEMS1 v5.2.1 with IKS01A2 extension and Application IKS01A2-DataLogTerminal. Project is generated for board NUCLEO-L053R8.

Just generated project couldn't be build. There is an error inside stm32l0xx_it.c, in function `USART2_IRQHandler()` error: "Undefined reference to huart2".

Same problem if this project is built for MDK-ARM v5.

CubeMX project file is attached. It's easy to regenerate the project.

I've tried to manually add #include or something in a hope that huart2 would become visible, but this BSP+MEMS1 Application seems like overcomplicated non-modular intertwined firmware. It's too hard to understand.

Please, can someone help me about this, just to make first build.

8 REPLIES 8

If it is a single undefined in another source file surely just defining it as an extern would suffice, unless it is a static in main.c

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

This works, but now I have problem with the Hard Fault. I'm debugging without IKS01A2 connected.

FW executes until the point when in need to initialize MX_Cube_MEMS1:

MX_X_CUBE_MEMS1_Init(void) --> MX_IKS01A2_DataLogTerminal_Init() --> IKS01A2_MOTION_SENSOR_GetCapabilities(i, &MotionCapabilities[i]) -->

int32_t IKS01A2_MOTION_SENSOR_GetCapabilities(uint32_t Instance, IKS01A2_MOTION_SENSOR_Capabilities_t *Capabilities)
{
  int32_t ret;
 
  if (Instance >= IKS01A2_MOTION_INSTANCES_NBR)
  {
    ret = BSP_ERROR_WRONG_PARAM;
  }
  else if (MotionDrv[Instance]->GetCapabilities(MotionCompObj[Instance], Capabilities) != BSP_ERROR_NONE)
  {
    ret = BSP_ERROR_UNKNOWN_COMPONENT;
  }
  else
  {
    ret = BSP_ERROR_NONE;
  }
 
  return ret;
}

The line `else if (MotionDrv[Instance]->GetCapabilities(MotionCompObj[Instance], Capabilities) != BSP_ERROR_NONE)` produces Hard Fault exception.

I have X-NUCLEO-IKS01A1, so there is a task awaiting :) - to port IKS01A1 code to this project and see if Hard Fault will be produced then.

Luca Celetto
ST Employee

Dear Mario,

I suggest you to

https://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-mems1.html

and the go to folder

STMicroelectronics.X-CUBE-MEMS1.5.2.1\Projects\STM32L053R8-Nucleo\Examples\IKS01A2\DataLogTerminal

The DataLogTerminal.ioc should have the right settings to solve your problem.

@parata.carlo​ for any follow-up.

Best regards,

Luca

parata.carlo
ST Employee

#MicroXplorer Configuration settings - do not modify

File.Version=6

I2C1.I2C_Speed_Mode=I2C_Fast

I2C1.IPParameters=I2C_Speed_Mode,Timing

I2C1.Timing=0x00000000

KeepUserPlacement=true

Mcu.Family=STM32L0

Mcu.IP0=I2C1

Mcu.IP1=NVIC

Mcu.IP2=RCC

Mcu.IP3=SYS

Mcu.IP4=USART2

Mcu.IPNb=5

Mcu.Name=STM32L053R(6-8)Tx

Mcu.Package=LQFP64

Mcu.Pin0=PC13

Mcu.Pin1=PC14-OSC32_IN

Mcu.Pin10=PB8

Mcu.Pin11=PB9

Mcu.Pin12=VP_SYS_VS_Systick

Mcu.Pin13=VP_STMicroelectronics.X-CUBE-MEMS1_VS_BoardOoExtensionJjMEMS_5.2.1

Mcu.Pin14=VP_STMicroelectronics.X-CUBE-MEMS1_VS_DeviceJjApplication_5.2.1

Mcu.Pin2=PC15-OSC32_OUT

Mcu.Pin3=PH0-OSC_IN

Mcu.Pin4=PH1-OSC_OUT

Mcu.Pin5=PA2

Mcu.Pin6=PA3

Mcu.Pin7=PA5

Mcu.Pin8=PA13

Mcu.Pin9=PA14

Mcu.PinsNb=15

Mcu.ThirdParty0=STMicroelectronics.X-CUBE-MEMS1.5.2.1

Mcu.ThirdPartyNb=1

Mcu.UserConstants=

Mcu.UserName=STM32L053R8Tx

MxCube.Version=5.0.0

MxDb.Version=DB.5.0.0

NVIC.EXTI4_15_IRQn=true\:0\:0\:false\:false\:true\:true

NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false

NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false

NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false

NVIC.SVC_IRQn=true\:0\:0\:false\:false\:true\:false

NVIC.SysTick_IRQn=true\:0\:0\:true\:false\:true\:true

PA13.GPIOParameters=GPIO_Label

PA13.GPIO_Label=TMS

PA13.Locked=true

PA13.Mode=Serial_Wire

PA13.Signal=SYS_SWDIO

PA14.GPIOParameters=GPIO_Label

PA14.GPIO_Label=TCK

PA14.Locked=true

PA14.Mode=Serial_Wire

PA14.Signal=SYS_SWCLK

PA2.GPIOParameters=GPIO_Label

PA2.GPIO_Label=USART_TX

PA2.Locked=true

PA2.Mode=Asynchronous

PA2.Signal=USART2_TX

PA3.GPIOParameters=GPIO_Label

PA3.GPIO_Label=USART_RX

PA3.Locked=true

PA3.Mode=Asynchronous

PA3.Signal=USART2_RX

PA5.GPIOParameters=GPIO_Label

PA5.GPIO_Label=LD2 [Green Led]

PA5.Locked=true

PA5.Signal=GPIO_Output

PB8.Locked=true

PB8.Mode=I2C

PB8.Signal=I2C1_SCL

PB9.Locked=true

PB9.Mode=I2C

PB9.Signal=I2C1_SDA

PC13.GPIOParameters=GPIO_Label,GPIO_ModeDefaultEXTI

PC13.GPIO_Label=B1 [Blue PushButton]

PC13.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING

PC13.Locked=true

PC13.Signal=GPXTI13

PC14-OSC32_IN.Locked=true

PC14-OSC32_IN.Mode=LSE-External-Oscillator

PC14-OSC32_IN.Signal=RCC_OSC32_IN

PC15-OSC32_OUT.Locked=true

PC15-OSC32_OUT.Mode=LSE-External-Oscillator

PC15-OSC32_OUT.Signal=RCC_OSC32_OUT

PCC.Checker=true

PCC.Line=STM32L0x3

PCC.MCU=STM32L053R(6-8)Tx

PCC.PartNumber=STM32L053R8Tx

PCC.Seq0=0

PCC.Series=STM32L0

PCC.Temperature=25

PCC.Vdd=null

PH0-OSC_IN.Locked=true

PH0-OSC_IN.Mode=HSE-External-Clock-Source

PH0-OSC_IN.Signal=RCC_OSC_IN

PH1-OSC_OUT.Locked=true

PH1-OSC_OUT.Signal=RCC_OSC_OUT

PinOutPanel.RotationAngle=0

ProjectManager.AskForMigrate=true

ProjectManager.BackupPrevious=false

ProjectManager.CompilerOptimize=6

ProjectManager.ComputerToolchain=false

ProjectManager.CoupleFile=false

ProjectManager.CustomerFirmwarePackage=

ProjectManager.DefaultFWLocation=true

ProjectManager.DeletePrevious=true

ProjectManager.DeviceId=STM32L053R8Tx

ProjectManager.FirmwarePackage=STM32Cube FW_L0 V1.11.0

ProjectManager.FreePins=false

ProjectManager.HalAssertFull=false

ProjectManager.HeapSize=0x200

ProjectManager.KeepUserCode=true

ProjectManager.LastFirmware=true

ProjectManager.LibraryCopy=0

ProjectManager.MainLocation=Src

ProjectManager.NoMain=false

ProjectManager.PreviousToolchain=

ProjectManager.ProjectBuild=false

ProjectManager.ProjectFileName=Test_Bug.ioc

ProjectManager.ProjectName=Test_Bug

ProjectManager.StackSize=0x400

ProjectManager.TargetToolchain=EWARM V8

ProjectManager.ToolChainLocation=

ProjectManager.UnderRoot=false

ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART2_UART_Init-USART2-false-HAL-true,4-MX_I2C1_Init-I2C1-false-HAL-true,3-MX_X_CUBE_MEMS1_Init-STMicroelectronics.X-CUBE-MEMS1.5.2.1-false-HAL-true,4-MX_X_CUBE_MEMS1_Process-STMicroelectronics.X-CUBE-MEMS1.5.2.1-false-HAL-true

RCC.48CLKFreq_Value=24000000

RCC.AHBFreq_Value=2097000

RCC.APB1Freq_Value=2097000

RCC.APB1TimFreq_Value=2097000

RCC.APB2Freq_Value=2097000

RCC.APB2TimFreq_Value=2097000

RCC.FamilyName=M

RCC.HSE_VALUE=8000000

RCC.HSI16_VALUE=16000000

RCC.HSI48_VALUE=48000000

RCC.HSI_VALUE=16000000

RCC.I2C1Freq_Value=2097000

RCC.IPParameters=48CLKFreq_Value,AHBFreq_Value,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,FamilyName,HSE_VALUE,HSI16_VALUE,HSI48_VALUE,HSI_VALUE,I2C1Freq_Value,LCDFreq_Value,LPTIMFreq_Value,LPUARTFreq_Value,LSI_VALUE,MSI_VALUE,PLLCLKFreq_Value,PWRFreq_Value,RTCFreq_Value,RTCHSEDivFreq_Value,SYSCLKFreq_VALUE,TIMFreq_Value,USART1Freq_Value,USART2Freq_Value,VCOOutputFreq_Value,WatchDogFreq_Value

RCC.LCDFreq_Value=37000

RCC.LPTIMFreq_Value=2097000

RCC.LPUARTFreq_Value=2097000

RCC.LSI_VALUE=37000

RCC.MSI_VALUE=2097000

RCC.PLLCLKFreq_Value=24000000

RCC.PWRFreq_Value=2097000

RCC.RTCFreq_Value=37000

RCC.RTCHSEDivFreq_Value=4000000

RCC.SYSCLKFreq_VALUE=2097000

RCC.TIMFreq_Value=2097000

RCC.USART1Freq_Value=2097000

RCC.USART2Freq_Value=2097000

parata.carlo
ST Employee

RCC.VCOOutputFreq_Value=48000000

RCC.WatchDogFreq_Value=37000

SH.GPXTI13.0=GPIO_EXTI13

SH.GPXTI13.ConfNb=1

STMicroelectronics.X-CUBE-MEMS1.5.2.1.ApplicationCcDeviceJjApplication=IKS01A2IiDataLogTerminal

STMicroelectronics.X-CUBE-MEMS1.5.2.1.BSP.number=4

STMicroelectronics.X-CUBE-MEMS1.5.2.1.BoardOoExtensionJjMEMS.apiComponent0=Board Extension\:IKS01A2

STMicroelectronics.X-CUBE-MEMS1.5.2.1.BoardOoExtensionJjMEMS.apiDoc0=Documentation/X_CUBE_MEMS1.chm

STMicroelectronics.X-CUBE-MEMS1.5.2.1.BoardOoExtensionJjMEMS.cmp_version0=5.2.1

STMicroelectronics.X-CUBE-MEMS1.5.2.1.BoardOoExtensionJjMEMS.component0=Board Extension

STMicroelectronics.X-CUBE-MEMS1.5.2.1.BoardOoExtensionJjMEMS.description0=MEMS library for X-NUCLEO-IKS01A2,X-NUCLEO-IKS01A2 BSP component drivers

STMicroelectronics.X-CUBE-MEMS1.5.2.1.BoardOoExtensionJjMEMS.diagnostic0=This component should operate correctly.

STMicroelectronics.X-CUBE-MEMS1.5.2.1.BoardOoExtensionJjMEMS.documentation0=Documentation/STMicroelectronics.X-CUBE-MEMS1_GettingStarted.pdf

STMicroelectronics.X-CUBE-MEMS1.5.2.1.BoardOoExtensionJjMEMS.group0=IKS01A2

STMicroelectronics.X-CUBE-MEMS1.5.2.1.BoardOoExtensionJjMEMS.paramName0=MEMSCcBoardOoExtensionJjIKS01A2

STMicroelectronics.X-CUBE-MEMS1.5.2.1.BoardOoExtensionJjMEMS.sevirity0=none

STMicroelectronics.X-CUBE-MEMS1.5.2.1.BoardOoExtensionJjMEMS_Checked=true

STMicroelectronics.X-CUBE-MEMS1.5.2.1.BoardOoExtensionJjMEMS_apiSize=1

STMicroelectronics.X-CUBE-MEMS1.5.2.1.BoardOoExtensionJjMEMS_bundle=MEMS

STMicroelectronics.X-CUBE-MEMS1.5.2.1.BoardOoExtensionJjMEMS_class=BoardOoExtension

STMicroelectronics.X-CUBE-MEMS1.5.2.1.BoardOoExtensionJjMEMS_name=X-CUBE-MEMS1

STMicroelectronics.X-CUBE-MEMS1.5.2.1.BoardOoExtensionJjMEMS_size=1

STMicroelectronics.X-CUBE-MEMS1.5.2.1.BoardOoExtensionJjMEMS_vendor=STMicroelectronics

STMicroelectronics.X-CUBE-MEMS1.5.2.1.BoardOoExtensionJjMEMS_version=5.2.1

STMicroelectronics.X-CUBE-MEMS1.5.2.1.DeviceJjApplication.apiComponent0=Board Extension\:IKS01A2

STMicroelectronics.X-CUBE-MEMS1.5.2.1.DeviceJjApplication.apiDoc0=Documentation/X_CUBE_MEMS1.chm

STMicroelectronics.X-CUBE-MEMS1.5.2.1.DeviceJjApplication.cmp_version0=5.2.1

STMicroelectronics.X-CUBE-MEMS1.5.2.1.DeviceJjApplication.component0=Device

STMicroelectronics.X-CUBE-MEMS1.5.2.1.DeviceJjApplication.description0=MEMS library applications,DataLogTerminal sample application for X-NUCLEO-IKS01A2

STMicroelectronics.X-CUBE-MEMS1.5.2.1.DeviceJjApplication.diagnostic0=This component should operate correctly.

STMicroelectronics.X-CUBE-MEMS1.5.2.1.DeviceJjApplication.documentation0=Documentation/STMicroelectronics.X-CUBE-MEMS1_GettingStarted.pdf

STMicroelectronics.X-CUBE-MEMS1.5.2.1.DeviceJjApplication.group0=Application

STMicroelectronics.X-CUBE-MEMS1.5.2.1.DeviceJjApplication.paramName0=ApplicationCcDeviceJjApplication

STMicroelectronics.X-CUBE-MEMS1.5.2.1.DeviceJjApplication.sevirity0=none

STMicroelectronics.X-CUBE-MEMS1.5.2.1.DeviceJjApplication.variant0=IKS01A2_DataLogTerminal

STMicroelectronics.X-CUBE-MEMS1.5.2.1.DeviceJjApplication_Checked=true

STMicroelectronics.X-CUBE-MEMS1.5.2.1.DeviceJjApplication_apiSize=1

STMicroelectronics.X-CUBE-MEMS1.5.2.1.DeviceJjApplication_bundle=Application

STMicroelectronics.X-CUBE-MEMS1.5.2.1.DeviceJjApplication_class=Device

STMicroelectronics.X-CUBE-MEMS1.5.2.1.DeviceJjApplication_name=X-CUBE-MEMS1

STMicroelectronics.X-CUBE-MEMS1.5.2.1.DeviceJjApplication_size=1

STMicroelectronics.X-CUBE-MEMS1.5.2.1.DeviceJjApplication_vendor=STMicroelectronics

STMicroelectronics.X-CUBE-MEMS1.5.2.1.DeviceJjApplication_version=5.2.1

STMicroelectronics.X-CUBE-MEMS1.5.2.1.IPParameters=MEMSCcBoardOoExtensionJjIKS01A2,ApplicationCcDeviceJjApplication

STMicroelectronics.X-CUBE-MEMS1.5.2.1.MEMSCcBoardOoExtensionJjIKS01A2=true

STMicroelectronics.X-CUBE-MEMS1.5.2.10.BSP.STBoard=false

STMicroelectronics.X-CUBE-MEMS1.5.2.10.BSP.api=BSP_BUS_DRIVER

STMicroelectronics.X-CUBE-MEMS1.5.2.10.BSP.component=

STMicroelectronics.X-CUBE-MEMS1.5.2.10.BSP.condition=SEMBoardOoExtensionJjIKS01A2

STMicroelectronics.X-CUBE-MEMS1.5.2.10.BSP.i2caddr=0

STMicroelectronics.X-CUBE-MEMS1.5.2.10.BSP.i2creg=

STMicroelectronics.X-CUBE-MEMS1.5.2.10.BSP.instance=I2C1

STMicroelectronics.X-CUBE-MEMS1.5.2.10.BSP.ip=I2C

STMicroelectronics.X-CUBE-MEMS1.5.2.10.BSP.mode=I2C

STMicroelectronics.X-CUBE-MEMS1.5.2.10.BSP.name=IKS01A2 BUS IO driver

STMicroelectronics.X-CUBE-MEMS1.5.2.10.BSP.semaphore=

STMicroelectronics.X-CUBE-MEMS1.5.2.10.BSP.solution=I2C1

STMicroelectronics.X-CUBE-MEMS1.5.2.11.BSP.STBoard=false

STMicroelectronics.X-CUBE-MEMS1.5.2.11.BSP.api=BSP_COMMON_DRIVER

STMicroelectronics.X-CUBE-MEMS1.5.2.11.BSP.component=

STMicroelectronics.X-CUBE-MEMS1.5.2.11.BSP.condition=

STMicroelectronics.X-CUBE-MEMS1.5.2.11.BSP.i2caddr=0

STMicroelectronics.X-CUBE-MEMS1.5.2.11.BSP.i2creg=

STMicroelectronics.X-CUBE-MEMS1.5.2.11.BSP.instance=PC13

STMicroelectronics.X-CUBE-MEMS1.5.2.11.BSP.ip=GPIO

STMicroelectronics.X-CUBE-MEMS1.5.2.11.BSP.mode=EXTI

STMicroelectronics.X-CUBE-MEMS1.5.2.11.BSP.name=BSP BUTTON

STMicroelectronics.X-CUBE-MEMS1.5.2.11.BSP.semaphore=

STMicroelectronics.X-CUBE-MEMS1.5.2.11.BSP.solution=PC13

STMicroelectronics.X-CUBE-MEMS1.5.2.12.BSP.STBoard=false

STMicroelectronics.X-CUBE-MEMS1.5.2.12.BSP.api=BSP_COMMON_DRIVER

STMicroelectronics.X-CUBE-MEMS1.5.2.12.BSP.component=

STMicroelectronics.X-CUBE-MEMS1.5.2.12.BSP.condition=

STMicroelectronics.X-CUBE-MEMS1.5.2.12.BSP.i2caddr=0

STMicroelectronics.X-CUBE-MEMS1.5.2.12.BSP.i2creg=

STMicroelectronics.X-CUBE-MEMS1.5.2.12.BSP.instance=USART2

STMicroelectronics.X-CUBE-MEMS1.5.2.12.BSP.ip=USART

STMicroelectronics.X-CUBE-MEMS1.5.2.12.BSP.mode=Asynchronous

STMicroelectronics.X-CUBE-MEMS1.5.2.12.BSP.name=BSP USART

STMicroelectronics.X-CUBE-MEMS1.5.2.12.BSP.semaphore=

STMicroelectronics.X-CUBE-MEMS1.5.2.12.BSP.solution=USART2

STMicroelectronics.X-CUBE-MEMS1.5.2.13.BSP.STBoard=false

STMicroelectronics.X-CUBE-MEMS1.5.2.13.BSP.api=BSP_COMMON_DRIVER

STMicroelectronics.X-CUBE-MEMS1.5.2.13.BSP.component=

STMicroelectronics.X-CUBE-MEMS1.5.2.13.BSP.condition=

STMicroelectronics.X-CUBE-MEMS1.5.2.13.BSP.i2caddr=0

STMicroelectronics.X-CUBE-MEMS1.5.2.13.BSP.i2creg=

STMicroelectronics.X-CUBE-MEMS1.5.2.13.BSP.instance=PA5

STMicroelectronics.X-CUBE-MEMS1.5.2.13.BSP.ip=GPIO

STMicroelectronics.X-CUBE-MEMS1.5.2.13.BSP.mode=Output

STMicroelectronics.X-CUBE-MEMS1.5.2.13.BSP.name=BSP LED

STMicroelectronics.X-CUBE-MEMS1.5.2.13.BSP.semaphore=

STMicroelectronics.X-CUBE-MEMS1.5.2.13.BSP.solution=PA5

STMicroelectronics.X-CUBE-MEMS1.5.2.1_BoardOoComponentJjMEMS_RteComponentsize=0

STMicroelectronics.X-CUBE-MEMS1.5.2.1_BoardOoExtensionJjMEMS_RteComponent0=\#define IKS01A2

STMicroelectronics.X-CUBE-MEMS1.5.2.1_BoardOoExtensionJjMEMS_RteComponentsize=1

STMicroelectronics.X-CUBE-MEMS1.5.2.1_BoardOoSupportJjSTM32CubeIiCustomIiBSPIiDrivers_RteComponentsize=0

STMicroelectronics.X-CUBE-MEMS1.5.2.1_DeviceJjApplication_RteComponent0=\#define IKS01A2_DATALOGTERMINAL_DEMO

STMicroelectronics.X-CUBE-MEMS1.5.2.1_DeviceJjApplication_RteComponentsize=1

STMicroelectronics.X-CUBE-MEMS1.5.2.1_MwName0=Application

STMicroelectronics.X-CUBE-MEMS1.5.2.1_NumberOfMw=1

STMicroelectronics.X-CUBE-MEMS1.5.2.1_SwParameter=ApplicationCcDeviceJjApplication\:IKS01A2IiDataLogTerminal;MEMSCcBoardOoExtensionJjIKS01A2\:true;

STMicroelectronics.X-CUBE-MEMS1.5.2.1_description=Drivers and sample applications for MEMS components

STMicroelectronics.X-CUBE-MEMS1.5.2.1_license=en.DM00367782.pdf

USART2.IPParameters=VirtualMode-Asynchronous

USART2.VirtualMode-Asynchronous=VM_ASYNC

VP_STMicroelectronics.X-CUBE-MEMS1_VS_BoardOoExtensionJjMEMS_5.2.1.Mode=BoardOoExtensionJjMEMS

VP_STMicroelectronics.X-CUBE-MEMS1_VS_BoardOoExtensionJjMEMS_5.2.1.Signal=STMicroelectronics.X-CUBE-MEMS1_VS_BoardOoExtensionJjMEMS_5.2.1

VP_STMicroelectronics.X-CUBE-MEMS1_VS_DeviceJjApplication_5.2.1.Mode=DeviceJjApplication

VP_STMicroelectronics.X-CUBE-MEMS1_VS_DeviceJjApplication_5.2.1.Signal=STMicroelectronics.X-CUBE-MEMS1_VS_DeviceJjApplication_5.2.1

VP_SYS_VS_Systick.Mode=SysTick

VP_SYS_VS_Systick.Signal=SYS_VS_Systick

board=NUCLEO-L053R8

boardIOC=true

parata.carlo
ST Employee

Hi Mario,

you can try the IoC that I posted above (split in 2 pieces). It works fine on my side with CubeMX v5.0.0, MEMS pack v5.2.1 and CubeL0 v1.11.0. Obviously, in order to test it you need a Nucleo-L053R8 and a X-NUCLEO-IKS01A2.

Best Regards,

Carlo

I don't have X-NUCLEO-IKS01A2.

It seems that calling the function

MotionDrv[Instance]->GetCapabilities(MotionCompObj[Instance], Capabilities) 

with parameters Instance = 0, Capabilities = NULL produces HardFault. - Because? - I'm not sure.

As much as I'm figured this out, There is no IKS01A2 connected so Capabilities stays NULL - it's updated to non of possible capability.

parata.carlo
ST Employee

Hi Mario,

actually, if you try to debug the code, you should find that all the IKS01A2_***_Init functions fail when they check the WHOAMI id of the several MEMS components (if you do not plug the IKS01A2, you will obviously get an error for any I2C transaction). So, all the Init functions in your case will exit with an error code and they are not able to assign the driver APIs (like the GetCapabilities) to the instances of the MEMS sensors. This is the reason why you get an HardFault when you call the GetCapabilities. In the sample application the error management was neglected for simplicity, so the real program flow should stop after the first error in the IKS01A2_***_Init. Anyway, in my opinion, it does not make sense to test this code if you do not have the IKS01A2. I hope that this explains the behavior that you see.

Best Regards,

Carlo