MAX14906

From Stm32World Wiki
Jump to navigation Jump to search


Basic software controls

  • LEDs can either be connected to the actual physical world, or software controllable. Register Config1 and bit 0 for Fault LEDs and bit 1 for Status LEDs
  • On power up, the device is in physical output mode. Meaning the DOIx pins are driven by the Dx data pins. If only software control is wanted, the Dx pins must be tied to GND.

Digital Output configuration

   max14906_write(&max14906_da, MAX14906_REG_SETOUT, 0x00);   // Set DOIx to outputs (bit4:7). bit0:3 = mysterious
   max14906_write(&max14906_da, MAX14906_REG_SETLED, 0x00);   // Turn off LEDs
   max14906_write(&max14906_da, MAX14906_REG_CONFIG1, 0x50);  // Enable latching of diagnostic fault bits in the OvrLdChF, OpnWirChF, and ShtVDDChF registers
   max14906_write(&max14906_da, MAX14906_REG_CONFIGDO, 0x2A); // Active-clamp PP
   max14906_write(&max14906_da, MAX14906_REG_CURLIM, 0x00);   //130mA

Digital Input configuration

   max14906_write(&max14906_ds, MAX14906_REG_SETOUT, 0xF0);   // Set DOIx to inputs (bit4:7). bit0:bit3 = ignored
   max14906_write(&max14906_ds, MAX14906_REG_SETLED, 0x00);   // Turn off LEDs
   max14906_write(&max14906_ds, MAX14906_REG_CONFIG1, 0x50);  // Enable latching of diagnostic fault bits in the OvrLdChF, OpnWirChF, and ShtVDDChF registers
   max14906_write(&max14906_ds, MAX14906_REG_CONFIGDI, 0x0);  // Type 1/3 inputs
   max14906_write(&max14906_ds, MAX14906_REG_CURLIM, 0x55);   // 130mA
   max14906_write(&max14906_ds, MAX14906_REG_MASK, 0xff);     // Fault pin = All errors

Register list

   #define MAX14906_REG_SETOUT    0x00    // Mode setting. Bit4:7=Input/Output mode, 0=Output, 1=Input.
   #define MAX14906_REG_SETLED    0x01    // LED status/control. bit4:7=Status, bit0:3=Fault
   #define MAX14906_REG_DOILEVEL  0x02    // ???
   #define MAX14906_REG_INTERRUPT 0x03    // Fault/error status/interrupt
   #define MAX14906_REG_OVRLDCHF  0x04    // Thermal and current limit status
   #define MAX14906_REG_OPNWIRCHF 0x05    // Open wire status and input over voltage status
   #define MAX14906_REG_SHTVDDCHF 0x06    // VDD Over-voltage and short-circuit status 
   #define MAX14906_REG_GLOBALERR 0x07    // Fault/error status
   #define MAX14906_REG_OPNWREN   0x08    // Open Wire detection and Gate Driver settings
   #define MAX14906_REG_CHTVDDEN  0x09    // VDD Over-voltage and output short-circuit settings
   #define MAX14906_REG_CONFIG1   0x0A    // LED, Filter and Latching settings
   #define MAX14906_REG_CONFIG2   0x0B    // Watchdog, Open-wire, short-circuit and VDD settings
   #define MAX14906_REG_CONFIGDI  0x0C    // Digital Input Mode settings
   #define MAX14906_REG_CONFIGDO  0x0D    // Digital Output Mode settings
   #define MAX14906_REG_CURLIM    0x0E    // Current limiting
   #define MAX14906_REG_MASK      0x0F    // Mask register, which errors go to FAULT pin

SPI Settings

On STM32, the default SPI configuration should work. That is Motorola frame format, 8 bits data size, MSB first, Clock Polarity Low and Clock Phase 1 edge.

Addressable SPI

The MAX14906 supports multiple (max 4) devices on the same SPI chip select, by encoding a hardwired address into the "register" byte, top 2 bits.

Links

MAX14906 Datasheet