SLYA060 August   2022 TMAG5110 , TMAG5110-Q1 , TMAG5111 , TMAG5111-Q1

 

  1.   Abstract
  2.   Trademarks
  3. Introduction
  4. System Block Diagram
  5. Key System Specifications
  6. HW Connections
  7. Software
    1. 5.1 TI-RSLK LaunchPad Software
    2. 5.2 LaunchPad Software
  8. How to Design With Hall-Effect Latches
  9. Simulation Results
    1. 7.1 Select Device Sensitivity
    2. 7.2 Select Axis of Sensitivity
  10. Performance Comparison
    1. 8.1 Speed and Direction
    2. 8.2 Power Consumption
    3. 8.3 Susceptibility to External Particles
  11. Encoder Board Schematic and Image
  12. 10Summary

TI-RSLK LaunchPad Software

When the TI-RSLK is first powered on, the various peripherals on the CC26x2 microcontroller are first initialized. The GPIOs are first initialized to the following configuration:

  • GPIO pins connected to the TMAG511x OUT1/OUT2 pins: These GPIOs are configured as input with interrupts. Each time there is a falling edge on one of these TMAG511x pins, an interrupt is generated to increment the falling-edge counter variable for that specific OUT pin. There are a total of variables that keep track of the number of falling edges since the last packet transmission to the PC LaunchPad:

    • ELA: This is the falling-edge counter variable for the OUT2 pin of the TMAG511x device that measures the speed of the left wheel module. This is cleared once per packet transmission.

    • ERA: This is the falling-edge counter variable for the OUT2 pin of the TMAG511x device that measures the speed of the right wheel module. This is cleared once per packet transmission.

    • ELB: This is the falling-edge counter variable for the OUT1 pin of the TMAG511x device that measures the speed of the left wheel module. This is cleared once per packet transmission.

    • ERB: This is the falling-edge counter variable for the OUT1 pin of the TMAG511x device that measures the speed of the right wheel module. This is cleared once per packet transmission.

  • GPIO pins connected to the PH pin of DRV8838 devices: These GPIO pins are configured as outputs. There are separate GPIO pins for the DRV8838 devices on the left and right wheel modules, which allows the different wheels to spin in opposite directions if ever desired in the future. Driving a logic low at one of these GPIO pins causes the corresponding wheel to spin forward while driving a logic high causes the wheel to spin backwards.

  • GPIO pins connected to the nSLEEP pin of DRV8838 devices: These GPIO pins are configured as outputs. There are also separate GPIO pins for the DRV8838 devices on the left and right wheel modules. These devices are never put in sleep mode, however, which means these GPIOs are always set to logic high.

  • GPIO pins connected to the EN pin of DRV8838 devices: These GPIO pins are configured as pulse-width modulated (PWM) outputs with a PWM period of 69.5 µs. There are separate GPIO pins for the DRV8838 devices on the left and right wheel modules, which means each DRV8838 can drive with a different duty cycle. These PWMs are also connected to LEDs on the LaunchPad. As a result, increasing the PWM duty cycle results in these LEDs becoming brighter.

After the GPIOs and other microcontroller peripherals are initialized, the TI-RSLK LaunchPad sends a message to the PC LaunchPad. This message includes the values of the ELA, ERA, ELB, and ERB variables, as well as the state of some GPIO pins on another device.

After sending the packet, the TI-RSLK packet waits for the PC LaunchPad to respond with the TMAG5273 X and Y axis readings from the joystick. When the TI-RSLK LaunchPad receives the TMAG5273 readings, the TI-RSLK LaunchPad converts these readings from register units into units of mT. The further up the joystick is, the more positive the Y axis reading. The TI-RSLK LaunchPad checks to see if the sensed Y reading is greater than the UP_THRESHOLD or less than the DOWN_THRESHOLD values. These thresholds are added so that the TI-RSLK only moves forward or backwards when the joystick has been at least pressed past a certain amount from the center position. This ensures that the TI-RSLK does not move when the joystick is near its center position. If the Y reading is greater than the UP_THRESHOLD, the TI-RSLK moves forward by setting each PH pin to logic low. If the Y reading is less than the DOWN_THRESHOLD, the TI-RSLK moves forward by setting each PH pin to logic high. The duty cycle is scaled so that the robot moves faster the closer the joystick is to its upmost or downmost position. Assuming that the sensed Y reading is greater than the UP_THRESHOLD, use the following formula to calculate the time spent at logic high within the 69.5-µs pulse period:

Equation 1. time_high = (DUTY_MIN × pwmPeriod + ((y_mT  UP_THRESHOLD)/(UP_MAX  UP_THRESHOLD)) × DUTY_MAX_INCREMENT × pwmPeriod

where:

  • DUTY_MIN is a fraction from 0 to 1 that represents which duty cycle to use when the Y reading equals UP_THRESHOLD. A value of 0 corresponds to logic 0 and a value of 1 corresponds to logic 1 during the entire pulse period.

  • pwmPeriod is the total time in a pulse period (69.5 µs in this case).

  • y_mT is the Y reading from the TMAG5273 in units of mT

  • UP_THRESHOLD is the desired minimum reading to trigger TI-RSLK movement. The user can experimentally determine this value by moving the joystick up from the center position until it reaches the minimum distance desired to trigger TI-RSLK movement. The user can then log the resulting Y reading as the UP_THRESHOLD value.

  • UP_MAX is the maximum Y reading observed when the joystick is pushed to its upmost position. The user can experimentally determine this value by pushing the joystick to its upmost position and then logging the resulting Y reading as the value for UP_MAX.

  • DUTY_MAX_INCREMENT is the change in the duty cycle fraction when the Y reading goes from UP_THRESHOLD to UP_MAX. DUTY_MAX_INCREMENT. This change is also expressed as a fraction from 0 to 1. Consequently, DUTY_MIN + DUTY_MAX_INCREMENT is the duty cycle fraction when the Y reading equals UP_MAX.

A similar formula also calculates the time spent at logic high when the sensed Y reading is less than the DOWN_THRESHOLD, but different thresholds and maximum values will be used instead (more specifically, UP_THRESHOLD is replaced by DOWN_THRESHOLD variable and UP_MAX is replaced with DOWN_MIN variable).