Is there a C-Code library available for register set, commands and basic functions of TPS92520?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Is there a C-Code library available for register set, commands and basic functions of TPS92520?
Currently, there is no C-Code library available for the http://www.ti.com/product/TPS92520-Q1 .
The following is the init we use on one of our TI designs http://www.ti.com/tool/TIDA-050030. When the enable pin is set high (power-up) and the registers are written as below you’ll be 520 watchdog disabled and ready to experiment with the device(s) as you wish. The init below also includes init for our http://www.ti.com/product/TPS92682-Q1 device.
Note that SEPIC_CODE is set to false.
void PowerItUp()
{
#if SEPIC_CODE
_682Sepic();
MAP_GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_5, GPIO_PIN_5); // set PC5 high; no high beam
while(MAP_GPIOPinRead(GPIO_PORTC_BASE, GPIO_PIN_5) == 0);
#else
MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_4, GPIO_PIN_4); // set PL4 high; enable pin
while(MAP_GPIOPinRead(GPIO_PORTL_BASE, GPIO_PIN_4) == 0);
_520Init(); // read status 3 reg
_682(); // init 682
_520(1); // init 520s
_520(2);
all520channelsOff();
#endif
powerOn = true;
}
void _520Init()
{
// device 1
readWriteSPI(0, 0x05, 0x00, 1);
readWriteSPI(0, 0x05, 0x00, 1);
// device 2
readWriteSPI(0, 0x05, 0x00, 2);
readWriteSPI(0, 0x05, 0x00, 2);
}
void _682()
{
// read stastus regs
readWriteSPI(0, 0x11, 0x00, 0); // read/write; register; data; device
readWriteSPI(0, 0x12, 0x00, 0);
// write 682 regs
readWriteSPI(1, 0x01, 0x23, 0);
readWriteSPI(1, 0x02, 0x08, 0);
readWriteSPI(1, 0x03, 0x05, 0);
readWriteSPI(1, 0x04, 0x77, 0);
readWriteSPI(1, 0x05, 0x34, 0);
readWriteSPI(1, 0x06, 0xFF, 0);
readWriteSPI(1, 0x07, 0xD5, 0);
readWriteSPI(1, 0x08, 0xD5, 0);
readWriteSPI(1, 0x09, 0x01, 0);
readWriteSPI(1, 0x0B, 0x00, 0);
readWriteSPI(1, 0x0A, 0x00, 0);
readWriteSPI(1, 0x0D, 0x00, 0);
readWriteSPI(1, 0x0C, 0x00, 0);
readWriteSPI(1, 0x0E, 0x0F, 0);
readWriteSPI(1, 0x0F, 0x0A, 0);
readWriteSPI(1, 0x10, 0x99, 0);
readWriteSPI(1, 0x13, 0x3C, 0);
readWriteSPI(1, 0x14, 0x0F, 0);
readWriteSPI(1, 0x15, 0x00, 0);
readWriteSPI(1, 0x16, 0x22, 0);
readWriteSPI(1, 0x17, 0x3C, 0);
readWriteSPI(1, 0x18, 0x00, 0);
readWriteSPI(1, 0x19, 0x00, 0);
readWriteSPI(1, 0x1A, 0x00, 0);
readWriteSPI(1, 0x1B, 0x00, 0);
readWriteSPI(1, 0x1C, 0x00, 0);
readWriteSPI(1, 0x1D, 0x00, 0);
readWriteSPI(1, 0x1E, 0x0F, 0);
readWriteSPI(1, 0x1F, 0x0A, 0);
readWriteSPI(1, 0x20, 0x99, 0);
readWriteSPI(1, 0x21, 0x3C, 0);
readWriteSPI(1, 0x22, 0x0F, 0);
readWriteSPI(1, 0x23, 0x00, 0);
readWriteSPI(1, 0x24, 0x22, 0);
readWriteSPI(1, 0x25, 0x00, 0);
// read status regs
readWriteSPI(0, 0x11, 0x00, 0);
readWriteSPI(0, 0x12, 0x00, 0);
// write
readWriteSPI(1, 0x00, 0x3D, 0);
}
void _520(uint8_t device)
{
// read 520 status regs
readWriteSPI(0, 0x03, 0x00, device); // read/write; register; data; device
readWriteSPI(0, 0x04, 0x00, device);
readWriteSPI(0, 0x05, 0x00, device);
//writes
readWriteSPI(1, 0x00, 0x00, device); // disable watchdog reg 0 bit 4
readWriteSPI(1, 0x01, 0x00, device);
readWriteSPI(1, 0x02, 0x08, device);
readWriteSPI(1, 0x06, 0x8A, device);
readWriteSPI(1, 0x07, 0x00, device);
readWriteSPI(1, 0x09, 0x4B, device);
if(device == 1)
{
readWriteSPI(1, 0x08, 0x00, device);
readWriteSPI(1, 0x20, 0x03, device);
readWriteSPI(1, 0x21, 0x6A, device);
}
else
{
readWriteSPI(1, 0x08, 0x01, device);
readWriteSPI(1, 0x20, 0x01, device);
readWriteSPI(1, 0x21, 0x6B, device);
}
readWriteSPI(1, 0x0B, 0x4B, device);
readWriteSPI(1, 0x0A, 0x00, device);
readWriteSPI(1, 0x0C, 0x04, device);
readWriteSPI(1, 0x0E, 0x00, device);
readWriteSPI(1, 0x0D, 0x05, device);
readWriteSPI(1, 0x10, 0x00, device);
readWriteSPI(1, 0x0F, 0x05, device);
readWriteSPI(1, 0x11, 0x07, device);
readWriteSPI(1, 0x12, 0x07, device);
readWriteSPI(1, 0x1E, 0x00, device);
readWriteSPI(1, 0x1F, 0x00, device);
readWriteSPI(1, 0x22, 0x00, device);
readWriteSPI(1, 0x23, 0x00, device);
readWriteSPI(1, 0x24, 0x00, device);
readWriteSPI(1, 0x25, 0x00, device);
readWriteSPI(1, 0x26, 0x00, device);
readWriteSPI(1, 0x27, 0x00, device);
readWriteSPI(1, 0x28, 0x00, device);
readWriteSPI(1, 0x29, 0x00, device);
readWriteSPI(1, 0x2A, 0x07, device);
readWriteSPI(1, 0x2B, 0x07, device);
readWriteSPI(1, 0x2C, 0x80, device);
// read 520 status regs
readWriteSPI(0, 0x03, 0x00, device); // read/write; register; data; device
readWriteSPI(0, 0x04, 0x00, device);
readWriteSPI(0, 0x05, 0x00, device);
}
thank you, this helps a lot.
Could you also name the parameter funtionality passed to the readWriteSPI function: readWriteSPI(1, 0x01, 0x23, 0);
Is this address, command, data, CS, etc?
You're welcome.
As noted in my initial reply to your original question.
// read 520 status regs
readWriteSPI(0, 0x03, 0x00, device); // read/write; register; data; device