element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Sustain The World - Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Sustain The World - Design Challenge
  • More
  • Cancel
Sustain The World - Design Challenge
Blog Garbage Collector #5 Base testing
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: wanfp97
  • Date Created: 13 Sep 2020 4:16 PM Date Created
  • Views 2022 views
  • Likes 3 likes
  • Comments 2 comments
  • dc motor
  • dave
  • xmc4700
  • garbage collector
  • xmc
  • tle94112
Related
Recommended

Garbage Collector #5 Base testing

wanfp97
wanfp97
13 Sep 2020

Blog List:

Garbage Collector #1 Introduction

Garbage Collector #2 Clamp testing

Garbage Collector #3 Seeking help from Infineon's Technical Supports

Garbage Collector #4 Some basic interactions with the shields

Garbage Collector #5 Base testing

Garbage Collector #6 Wireless Controller

Garbage Collector #7 Clamp and Base

Garbage Collector #8 Clamp Improvement

Garbage Collector #9 Doubling the maximum current

Garbage Collector #10 Summary

 

Previously I have successfully tested the DC Motor Shield using the example code in Arduino IDE. However, one of the tech support from Infineon told me that currently there is no FreeRTOS support for XMC in Arduino IDE, so, I have decided to move my working environment from Arduino IDE to DAVE.

 

At first, I have faced some difficulties in controlling the DC Motor Shield in DAVE. Thankfully, one of the tech support, Mr. Dominik jd_tech_support_ifx sent me the source code from his colleague and I was able to figure out how should I control the DC Motor Shield in DAVE.

I'm not sure how to upload files in here, but you can find the files in the ext_lib folder in the following GitHub link:

tle94112el.c:                https://github.com/wanfp97/freertos_motor/blob/master/ext_lib/tle94112el.c

tle94112el.h:                https://github.com/wanfp97/freertos_motor/blob/master/ext_lib/tle94112el.h

tle94112el_regs.h:       https://github.com/wanfp97/freertos_motor/blob/master/ext_lib/tle94112el_regs.h

 

also, in order for these codes to work, a few lines of codes must be added as well:

static void tle94112el_enable(void);
static void tle94112el_disable(void);
static int32_t tle94112el_spi_transfer(uint8_t *tx_data, uint8_t *rx_data);


static const TLE94112EL_t TLE94112EL_0 =


  {


    .enable = tle94112el_enable,


    .disable = tle94112el_disable,


    .spi_transfer = tle94112el_spi_transfer


  };

 

static void tle94112el_enable(void)


{


  DIGITAL_IO_SetOutputHigh(&TLE94112_ENABLE);


}


static void tle94112el_disable(void)


{


  DIGITAL_IO_SetOutputLow(&TLE94112_ENABLE);


}


static int32_t tle94112el_spi_transfer(uint8_t *tx_data, uint8_t *rx_data)


{


  XMC_SPI_CH_SetBitOrderLsbFirst(SPI_MASTER_0.channel);






  DIGITAL_IO_SetOutputLow(&TLE94112_CS);






  SPI_MASTER_Transfer(&SPI_MASTER_0, tx_data, rx_data, 2);


  while(SPI_MASTER_0.runtime->rx_busy);






  DIGITAL_IO_SetOutputHigh(&TLE94112_CS);






  return 0;


}

using these source codes, I'm was able to control DC Motor Shiled using the function TLE94112EL_SetHBrigeOutput(const TLE94112EL_t *const handler, TLE94112EL_HBRIDGE_t hbridge, TLE94112EL_HBRIDGE_OUTPUT_t output); to set one TLE94112EL_HB output at a time.

 

However, in my case, I would like to control a few TLE94112EL_HB outputs at once to control the movement of the base of the Garbage Collector. Eventually, I have added base.h and base.c by referring to the codes MR. Dominik sent me:

base.h:                         https://github.com/wanfp97/freertos_motor/blob/master/ext_lib/base.h

base.c:                         https://github.com/wanfp97/freertos_motor/blob/master/ext_lib/base.c

 

so that I can use the TLE94112EL_SetHBRegdata(const TLE94112EL_t *const handler, uint8_t TLE94112EL_HB_ACT_X_CTRL, uint8_t regdata); to set 4 TLE94112EL_HB outputs at once since each TLE94112EL_HB_ACT_1_CTRL, TLE94112EL_HB_ACT_2_CTRL, and TLE94112EL_HB_ACT_3_CTRL can control 4 TLE94112EL_HB outputs.The XMC4700 will now only need to send 2 SPI data to the TLE94112EL (configure 8 TLE94112EL_HB outputs) (configure 4 at once) instead of 8 SPI data (configure 8 TLE94112EL_HB outputs one by one) in order to control 4 DC motors.

Below is the content of base.c that I have added.

#include "base.h"


int32_t TLE94112EL_SetHBRegdata(const TLE94112EL_t *const handler, uint8_t TLE94112EL_HB_ACT_X_CTRL, uint8_t regdata)
{
  if ((TLE94112EL_HB_ACT_X_CTRL >= 0x04)|(TLE94112EL_HB_ACT_X_CTRL <= 0x00))
  {
return -1;
  }


  uint8_t tx_data[2];
  uint8_t rx_data[2];
  uint8_t addr;


switch(TLE94112EL_HB_ACT_X_CTRL){


case 1:
addr = TLE94112EL_HB_ACT_1_CTRL;
break;


case 2:
addr = TLE94112EL_HB_ACT_2_CTRL;
break;


case 3:
addr = TLE94112EL_HB_ACT_3_CTRL;
break;


}


  //write
  tx_data[0] = addr | 0x80;
  tx_data[1] = regdata;


  handler->spi_transfer(tx_data, rx_data);


  return rx_data[0];
}

 

The GitHub link below is a simple DAVE project that I have created to test controlling DC Motors:

GitHub link: https://github.com/wanfp97/freertos_motor

 

After some cutting and drilling, I have constructed the base of the Garbage Collector using biscuit tin and attached 4 DC motors to it:

 

imageimageimage

 

Below is the video of base movement testing:

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

Design flow check point:

image

 

The next thing I will do is to change the controller to a wireless controller. Till then, see ya.

  • Sign in to reply

Top Comments

  • DAB
    DAB over 4 years ago +1
    Nice update. DAB
  • jd_tech_support_ifx
    jd_tech_support_ifx over 4 years ago +1
    Very cool Fook Peng Looking forward to seeing your next update! BR, JD
  • jd_tech_support_ifx
    jd_tech_support_ifx over 4 years ago

    Very cool Fook Peng image

     

    Looking forward to seeing your next update!

     

    BR,

    JD

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 4 years ago

    Nice update.

     

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube