Other Parts Discussed in Thread: DRV8323,
Hello,
I am trying to set DRV8323 in PWM 1X mode but i am unable to the SPI registers. I am able to read the default values of SPI all registers and unable to write SPI registers and read the same. Need Some assistance.
I am attaching my simple code to read and write the registers
void main()
{
// initialize the device
SYSTEM_Initialize();
uint16_t i,j,DCR_2;
b=0x9000; // ADDRESS OF DRIVER CONTROL REGISTER FOR READING
DCR_2=0x1052;// trying to set PWM 1X in driver control register
DRV_EN=0;
for(i=0;i<1000;i++);
DRV_EN=1; // Enabling DRV
j=0;
SPI_SS_PORT=1;
for(i=0;i<1000;i++);
while(1)
{
SPI_SS_PORT=0;
SPI1_Write(&DCR_2); // TRYING WIRTE THE DATA TO DRIVER CONTROL REGISTER
SPI_SS_PORT=1;
for(i=0;i<10000;i++);
SPI_SS_PORT=0;
SPI1_Exchange(&b,&j);// VERIFYING AND READING DRIVER CONTROL REGSITER b REPRESENST THE ADDRES OF DCR j REPRESENTS WHERE THE VALUE IS BEING STORED
SPI_SS_PORT=1;
for(i=0;i<10000;i++);
}
}
Thank You.