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!
- BTN8982 Shield Project
- Hardware Overview
- Arduino Bi-directional Motor Control Demonstration
- DAVE4 CE Project
- BTS50010 Shield Project
- Hardware Overview
- Arduino Blinky Bulb Demonstration
- DAVE4 CE Project
- 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)
- 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
- Motor should spin up then down then reverse up then down
- 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
- 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
- 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
- Add DAVE App DIGITAL_IO
- Set as Input/Output
- Set as High for Initial Output Level
- Rename INH_2
- 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();
- 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
- 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
- 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
- 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)
- 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!!!
- 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
- 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
- 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
- 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