Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Infineon/BTN8982-Shield-BTS50010-Shield-Hands-On-Training

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 

Repository files navigation

BTN8982-Shield-BTS50010-Shield-Hands-On-Training

SAFETY FIRST & Disclaimer

WARNING: If you put anything on end of MOTOR it will spin fast and will hurt/make you bleed/damage your surroundings… You take full responsibility if you choose to put anything on the end of the motor!!! Bulbs Heat Up…if you leave it on even a short time it will burn you!

Hands On Training Agenda

BTN8982 Shield Project

Hardware Overview

  • XMC1100 Boot Kit
  • BTN8982 Arduino Shield
  • 12V Power Supply
  • USB Cable
  • Brushed DC Motor
  • Power Sequence
    • Connect Shield to Boot Kit
    • Connect Motor to OUT1 and OUT2 (for bi-directional control)
    • Power XMC kit through micro-USB cable
    • Program XMC Boot kit (through DAVE/Arduino)
    • Connect 12v GND to Shield GND
    • Connect 12v Power to Shield VBAT
    • Turn on supply (aka plug in supply)

XMC1100 Boot Kit Pin Descriptions

BTN8982 Shield Overview

BTN8982 Shield Pin Descriptions

Arduino Bi-directional Motor Control Demonstration

Arduino UI Setup
  • Install Arduino per Arduino Website instructions
  • Install XMC for Arduino per XMC Github instructions
  • Install BTN8982 Shield .zip package per BTN8982 Github instructions
  • Setup Arduino UI
    • Make sure XMC1100 Boot Kit is the target board
    • Look at Windows `Device Manager´ to find COM Port
    • Make sure you are targeting the correct COM Port
    • Compile and upload Sketch
Arduino -> File -> Preferences

Arduino File Preferences

Arduino -> Tools -> Board: “xyz” -> Boards Manager

Arduino Board Manager -> “XMC” Search (Note: need network connection)

Arduino Board Manager XMC search

Add BTN8982 Zip library

Open the example Sketch

Verify Board and COM “XMC1100 Boot Kit”

Upload Sketch (Auto Compiles)

  • Motor should spin up then down then reverse up then down
Bi-directional Arduino Code

DAVE4 CE Project

Launch DAVE 4 – Assign a workspace

Create a new DAVE CE Project

New DAVE CE Project

Select XMC1100 Boot Kit

If all was successful go to DAVE IDE and Project…

Ready to go IDE and Project

Closer look at the tool bar…

So what are we trying to do…
  • Essentially we have four pins to control
  • For each half bridge (BTN8982)
    • We can enable the bridge INH_x
    • We can toggle the IN_x pin
  • We can also monitor the current in each half bridge
    • IS_x Current Sense or Diagnostics

BTN8982 Truth Table…
  • So if INH_x = 0 then half bridge is off; if it = 1 then IN_x toggles which FET (LSS or HSS) is active
  • In_x = 0; LSS is active
  • IN_x = 1; HSS is active

We have options…
  • Option 1: PWM all four signals
    • Most flexible but it is basically setting up the same DAVE App 4 times
  • Option 2: INH_x as a standard I/O; PWM the IN_x inputs
    • Seems likle we´d have to setup a couple different apps
    • Limited in the possible waveforms to generate, but will cover basics
  • Option 3: All four inputs as Standard I/O
    • Limited to on/off control verses controlling PWM to change speed
    • Again only one DAVE App to setup
  • Lastly we can set up the A/D for the IS_x
    • XMC1100 has simple A/D; we just setup one channel for ease of the training
Setup DAVE App for INH_1

Should see DIGITAL_IO App…double click it

Change name by right clicking app…

Should look like this… (Note we haven’t assigned pins yet…)

Change Name_Done

Repeat these steps for INH_2
  • Add DAVE App DIGITAL_IO
    • Set as Input/Output
    • Set as High for Initial Output Level
    • Rename INH_2

Setup PWM for IN_1 Output Hmmm…2 different PWM options

Configure the App and Rename to IN_1

Configure App and Rename to IN_1

Configure App and Rename to IN_1_2

Setup PWM for IN_2 - Using other PWM Function

Configure App and rename to IN_2

Configure App and Rename to IN_2.3

Configure App and Rename to IN_2_2.4

Rearrange apps (not required)

Rearrange Apps

Let’s add an ADC measurement for IS_1

ADC measurment for IS_1.2

Setup ADC App, rearranged, renamed to IS_1

Setup ADC App_rearranged

Let’s write some code
  • What do we need... not a lot since we will use uC-Probe to control the system
  • Some global variables for PWM duty cycle and to store ADC readings
    volatile int32_t PWM_DutyCycle_IN_1 = 0; 
    volatile int32_t PWM_DutyCycle_IN_2 = 0;
    volatile XMC_VADC_RESULT_SIZE_t ADC_IS_1 = 0;
  • Some code to set the values...
    PWM_CCU4_SetDutyCycle(&IN_1, PWM_DutyCycle_IN_1);
    PWM_SetDutyCycle(&IN_2, PWM_DutyCycle_IN_2);
    ADC_IS_1 = ADC_MEASUREMENT_GetGlobalResult();
Where to put the 2 blocks of code…

Pin Mapping

Pin Mapping.2

Assign the HW Pins to the DAVE App Signals
  • IN_1 = D3 = P0.0
  • IN_2 = D11 = P1.1
  • INH_1 = D12 = P1.0
  • INH_2 = D13 = P0.7
  • IS_1 = A0 = P2.6
  • Right click on pin to select Signal

Generate DAVE code then build…

Generate DAVE Code

Launch Debugger and run code

Launch Debugger.2

Setup debug interface…(double click Segger)

Opens Debug Perspective – click run

Debug Perspective.2

Setup uC_Probe

Point to DAVE Workspace .elf file

Save your file (I use DAVE debug workspace)

Add a slider for IN_1 Duty Cycle - Drag and drop

Configure the slider (0000 to 10000 are correct range for Duty Cycle)

Name (Drag text box and edit it)

Assign the Duty Cycle Variable to it (Drag and Drop over slider)

Add cool meter for Duty Cycle IN_1

Repeat for Duty Cycle IN_2 (Copy widgets from IN_1, drag new Variable)

Run uC Probe (be sure DAVE Debug code is running)

Left slider = Forward
Right slider = Reverse

Add graph for IS_1 Signal (resize to fit)

Should look something like this... (Do not forget to save)

What´s up with the IS_1 singal???
  • If you look at the truth table...

  • So only valid reading when HSS FET is high otherwise it’s an offset(Diagnostics)
  • Currently code just continuously makes IS_1 ADC conversion and is displaying in uC-Probe…
  • Note if you run in reverse (PWM IN_2) the HSS_1 never goes high and IS_1 signal is steady = offset
How can we make our code smarter???
  • Let´s try to trigger the ADC when IN_1 is High during the PWM
  • Good thing we used the PWM_CCU4 App for IN_1 signal, as it seems to be a little more feature rich than the PWM App
  • Basically we will wire our existing DAVE Apps to accomplish this and we should not have to change our C code at all
    • I.e. we will only make an ADC during the high time of the IN_1 PWM Signal… {Correction, we read ADC at period match, if duty cycle is 0 or low it will still take reading}
    • We will only make changes to the Apps configuration
    • We will need to generate the new App code and rebuild
Modify the ADC (Stop the debugger, click DAVE CE perspective)

Modify the ADC

Modify PWM_CCU4 IN_1

Modify PWM_CCU4 IN_1.3

Connect HW Signals (Right Click)

Connect HW Signals.2

Configure IN_1

Generate Code and Build; run Probe

BTS50010 Shield Project

Hardware Overview

  • XMC1100 Boot Kit
  • BTS50010 Arduino Shield
  • 12V Power Supply
  • USB Cable
  • Automotive 12V Bulb
  • Power Sequence
    • Connect Shield to Boot Kit
    • Connect Bulb to LOAD and GND
    • Power XMC Boot Kit through micro USB cable
    • Program XMC Boot Kit (through DAVE/Arduino)
    • Connect 12V GND to Shield GND
    • Connect 12V Power to Shield VBAT
    • Turn on supply (aka plug in supply)

XMC1100 Boot Kit Pin Discriptions

BTS50010 Shield Overview

BTS50010 Pin Descriptions

Arduino Blinky Bulb Demonstration

Arduino Blinky Bulb Demo
  • Open Blinky Bulb Demo Sketch
    • [your path]\Avnet FAE Training 10-10-2018\Arduino Workspace\bts50010 Shield Sketches\BTS500010_Automotive_Bulb
  • Connect Shield to Boot Kit
  • Connect Shield to LOAD and GND
  • Connect Bulb to LOAD and GND
  • Power XMC Kit through micro-USB cable
  • Program XMC Boot Kit (Arduino)
    • Make sure XMC1100 Boot Kit and COM set correctly
  • Upload sketch
  • LED1 and LED2 should alternate
  • Apply 12V Power (GND first) to Shield
  • Bulb should turn on and off
  • WARNING: Bulb will get hot!!!
Blinky Blub Code

DAVE4 CE Project

BTS50010 Shield DAVE Project
  • Exercise 1:
    • Create new DAVE CE Project
    • Target XMC1100 Boot Kit w/BTS50010 Shield
    • Use DAVE Apps to turn on/off bulb with uC-Probe Switch
  • Hint: Can create a switch variable, and then check if switch is high or low to call appropriate DAVE I/O app method; assign the switch variable to a uc-Probe widget
  • Advanced Exercise 2 & 3:
    • Make Bulb Blink like in Arduino Demo
  • Hint 1: PROFET PWM max speed is 100Hz; for bulb, shoot for on/off time in seconds range
  • Hint 2: or use systimer
Exercise 1 (Cheat Sheet)
  • Create new DAVE CE Project
  • Drop DIGITAL_IO App
    • Configure as Output
    • Rename it to "IN_BTS50010"
    • Set initial level to 0
  • Map Pin to correct I/O Pin
    • Hint: It is P0.3
  • Create a volatile int called light_switch default = 0
    • volatile int32_t light_switch = 0;
  • Create C-Code logic in the while{1U} loop
    • If (light_switch == 0) then {turn off bulb} else {turn on bulb}
  • Call DIGITAL_IO Methods for turning on I/O
    • DIGITAL_IO_SetOutputHigh(&IN_BTS50010);
    • DIGITAL_IO_SetOutputLow(&IN_BTS50010);
  • Generate DAVE Code then compile your code then run debugger
  • Launch Probe; point to new .elf file
    • Drop widget with values 1 or 0; (Toggle)
    • Drag light_switch variable to widget
    • Should be good to go
Exercise 2 (Cheat Sheet)
  • Create new DAVE CE Project
  • Drop PWM App
    • Configure as Output
    • Rename it to "IN_BTS50010"
    • Set frequency to min 1Hz or something you can see
    • Set Duty Cycle to 50% (more or less to your preference)
    • Start on initialization
  • Map Pin to correct I/O Pin
    • Hint: It is P0.3
  • Should not need C-Code
  • Generate DAVE Code then compile your Code then run debugger
  • Bulb should be blinking; but fast
Exercise 3 (Cheat Sheet)
  • Setup DIGIT_IO pin as in the other examples
  • Use SYSTIMER to create a 1 or 2 second timer
  • See `usage´ from DAVE App Help for SYSTIMER for cheat codes

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published