Sample C Code for EV-MCS-LVDRV-Z (FlexMC LV) platform

Document created by DOSulli2 Employee on Jan 12, 2015Last modified by DOSulli2 Employee on Jan 15, 2015
Version 2Show Document
  • View in full screen mode

The attached zip file contains an IAR Embedded Workbench project with sample C code that can be loaded on to an ADSP-CM408 EZkit for development of a motor control application. The sample code contains an open loop Volts/Hertz algorithm that can be run in conjunction with the EV-MCS-LVDRV-Z motor control platform. The Windows Graphical User Interface (and associated user guide) found here can be used to get a motor up and running with the boards. The ADI Software Enablement (SWE) Package, to which the user guide refers, must also be downloaded and installed.

The following should be noted:

LED1 on EZkit flashing regularly - motor control algorithm is running

LED2 on EZkit is ON - PWM trip has occurred due to overcurrent. Press 'Stop' on the GUI to send a Stop Motor command. This should reset the error, and the LED should turn off.


The following Project Options also need to be set in IAR Embedded Workbench:


General Options->Target->Device=AnalogDevices ADSP-CM40z-384_2048 (will only be visible after the ADI SWE has been installed). On same tab an FPU must be selected


General Options->Library Configuration- Select Use CMSIS and DSP Library


C/C++ Compiler->Preprocessor->Additional include directories

C:\Analog Devices\ADSP-CM40x\CM403F_CM408F_EZ-KIT\inc

C:\Analog Devices\ADSP-CM40x\CM403F_CM408F_EZ-KIT\inc\sys

C:\Analog Devices\ADSP-CM40x\CM403F_CM408F_EZ-KIT\src






On the same tab: Defined symbols



Linker->Library->Additional libraries

C:\Analog Devices\ADSP-CM40x\CM403F_CM408F_EZ-KIT\lib\iar\debug\libdrv40z.a

C:\Analog Devices\ADSP-CM40x\CM403F_CM408F_EZ-KIT\lib\iar\debug\libosal40z_noos.a

C:\Analog Devices\ADSP-CM40x\CM403F_CM408F_EZ-KIT\lib\iar\debug\libssl40z.a



Linker->List- Select Generate linker map file


Options->Debugger->Download- Select Use flash loader

Options->Debugger->J-Link/J-Trace->Setup -Select Connect during reset

Options->Debugger->J-Link/J-Trace->Connection - Select SWD