You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/01/25 02:01:58 UTC

[GitHub] jacobrosenthal commented on issue #757: WIP: hw driver: drv2605l

jacobrosenthal commented on issue #757: WIP: hw driver: drv2605l
URL: https://github.com/apache/mynewt-core/pull/757#issuecomment-360336904
 
 
   For anyone here who might have a drv2605 and an LRA lying around, heres a starting point and something that can be a tutorial soon:
   
   
   ```
   add the driver in your target's pkg.yml
   pkg.deps:
     "@apache-mynewt-core/hw/drivers/drv2605"
   
   Turn on everything in your syscfg.yml
       I2C_0: 1 #drv2605
       DRV2605_OFB: 1
       DRV2605_CLI: 1
       DRV2605_LOG: 1
       DRV2605_STATS: 1
       
       
   and now the hard part you need to read the drv2605l datasheet or get a bunch of numbers from your motor manufacturer so you can override your motors voltage and other settings. 
       # these are settings taken from the drv2605 evm for the SEMCO1030 (Mplus)
       # 205hz freq, nominal voltage 1.5V, max voltage 3.0V, DRV2605_LRA_SAMPLE_TIME: 3, DRV2605_LRA_BLANKING_TIME: 2, DRV2605_LRA_IDISS_TIME: 2
   
       DRV2605_RATED_VOLTAGE: 0x3E # See 8.5.2.1 Rated Voltage Programming
       DRV2605_OD_CLAMP: 0x89 # '8.5.2.2 Overdrive Voltage-Clamp Programming, Note: LRA and ERM (8) and (9) equations are swapped in the "SLOS854C REVISED SEPTEMBER 2014" datasheet, confirmed https://e2e.ti.com/support/other_analog/haptics/f/927/t/655886'
       DRV2605_DRIVE_TIME: 19 # '8.5.2.2 Overdrive Voltage-Clamp Programming, Note: LRA and ERM (8) and (9) equations are swapped in the "SLOS854C REVISED SEPTEMBER 2014" datasheet, confirmed https://e2e.ti.com/support/other_analog/haptics/f/927/t/655886'
       
       
   And now you need calibration values, you might have gotten these from someone as well and you can just override them as well. These are the SEMCO1030 again. If you dont have them you're ok for now but youll need to generate them later
   
       DRV2605_CALIBRATED_COMP: 0x09
       DRV2605_CALIBRATED_BEMF: 0x79
       DRV2605_CALIBRATED_BEMF_GAIN: 1
           
   Start up your board and head to the shell we turned on earlier
   
    
   I recommend first things first see if you can talk to device with
   053273 compat> drv2605 chip_id
   drv2605 chip_id
   118613 0x07
   
   next see if your calibration numbers work (make sure your motor is secured to something)
   118613 compat> drv2605 diag
   drv2605 diag
   120858 Diagnostic Complete
   
   
   If they didnt work or you didnt have good values overriden from before youll need to generate them
   if you need to autocal your device you can do that from here too with autocal brake_factor loop_gain lra_sample_time lra_blanking_time lra_idiss_time auto_cal_time lra_zc_det_time
   NOTE you need to figure out your numbers, not use these
   001407 compat> drv2605 autocal 3 1 2 3 2 2 0
   drv2605 autocal 3 1 2 3 2 2 0
   001931 Autocal Complete
   001931 DRV2605_CALIBRATED_COMP: 0x2C
   DRV2605_CALIBRATED_BEMF: 0x49
   DRV2605_CALIBRATED_BEMF_GAIN: 3
   
   now youd want to save these as overrides in your target's syscfg.yml
   
   next try to load some of the internal roms, 4 hard clicks (1) with max delays in between (255)
   120858 compat> drv2605 load 1 255 1 255 1 255 1 255
   drv2605 load 1 255 1 255 1 255 1 255
   122555 Load succeeded
   
   now you can trigger those forms
   122555 compat> drv2605 trigger
   drv2605 trigger
   128806 Trigger succeeded
   
   Its handy to dump the register contents as you're poking around to see if what you think you did worked
   001931 compat> drv2605 dump_all
   drv2605 dump_all
   069774 reg 0x:00 = 0xE0
   069774 reg 0x:01 = 0x40
   069774 reg 0x:02 = 0x00
   069774 reg 0x:03 = 0x06
   069774 reg 0x:04 = 0x01
   069774 reg 0x:05 = 0xFF
   069774 reg 0x:06 = 0x01
   069774 reg 0x:07 = 0xFF
   069775 reg 0x:08 = 0x01
   069775 reg 0x:09 = 0xFF
   069775 reg 0x:0A = 0x01
   069775 reg 0x:0B = 0xFF
   069775 reg 0x:0C = 0x00
   069775 reg 0x:0D = 0x00
   069775 reg 0x:0E = 0x00
   069775 reg 0x:0F = 0x00
   069775 reg 0x:10 = 0x00
   069775 reg 0x:11 = 0x05
   069775 reg 0x:12 = 0x19
   069775 reg 0x:13 = 0xFF
   069775 reg 0x:14 = 0x19
   069775 reg 0x:15 = 0xFF
   069775 reg 0x:16 = 0x3E
   069775 reg 0x:17 = 0x89
   069775 reg 0x:18 = 0x2C
   069775 reg 0x:19 = 0x49
   069775 reg 0x:1A = 0xB7
   069775 reg 0x:1B = 0x93
   069775 reg 0x:1C = 0x2E
   069775 reg 0x:1D = 0x00
   069775 reg 0x:1E = 0x20
   069775 reg 0x:1F = 0x00
   069776 reg 0x:20 = 0x33
   069776 reg 0x:21 = 0x6F
   069776 reg 0x:22 = 0x3D
   069776 compat> 
   
   you can also peek and poke individual registers, ill manually take it out of standby
   074759 compat> drv2605 poke 1 0
   drv2605 poke 1 0
   083307 Wrote: 0x00 to 0x01
   083307 compat> drv2605 peek 1
   drv2605 peek 1
   083883 Value: 0x00
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services