Hi,
We are using DRV8353RS EVM board, Its Working fine with its ISO-F28027F with GUI control.
Now we have removed the ISO-F28027F from the EVM. and we have connected an external controller to read the register value through SPI.
Default value read from DRV-
R0= 0x0100
R1=0x0200
and all other are just zero. Even R0 and R1 value is continuously changing with 0 and R0= 0x0100 and R1=0x0200.
and even if I am writing any other value on registers through SPI its not getting changed.
Connections-:
We have connected MCU with EVM according to 1x PWM Mode
Enable pin ==> MCU GPIO (Write High)
SCLK pin ==> SPI Serial clock pin
SDI pin ==> MOSI
SDO pin ==>MISO
nSCS pin ==>Chip Select
INLC (Brake) ==>MCU GPIO (Write High)
INHC (DIR) ==>MCU GPIO (Write LOW)
INLA ==>HALLA of motor
INHB ==>HALLB of motor
INLB ==>HALLC of motor
nFault ==> MCU GPIO (Read High) No fault case
Power Supply 24v
SPI Initialization
void MX_SPI1_Init(void)
{
hspi1.Instance = SPI1;
hspi1.Init.Mode = SPI_MODE_MASTER;
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
hspi1.Init.DataSize = SPI_DATASIZE_16BIT;
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
hspi1.Init.CLKPhase = SPI_PHASE_2EDGE;
hspi1.Init.NSS = SPI_NSS_SOFT;
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hspi1.Init.CRCPolynomial = 7;
hspi1.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE;
hspi1.Init.NSSPMode = SPI_NSS_PULSE_DISABLE;
if (HAL_SPI_Init(&hspi1) != HAL_OK)
{
Error_Handler();
}
}
DRV Read / Write
void DRVWrite(uint8_t addr, uint16_t data){
uint16_t temp;
temp= data | (addr <<11);
//HAL_Delay(2);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_RESET); //chip select
dataVarTx=temp;
HAL_SPI_Transmit(&hspi1,(uint8_t*) (&dataVarTx), 1, 50);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_SET);
}
uint16_t DRVRead(uint8_t addr){
uint16_t tempTx, tempRx;
//HAL_Delay(2);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_RESET);
tempTx=1<<15 | (addr <<11);
HAL_SPI_TransmitReceive(&hspi1,(uint8_t*)(&tempTx), (uint8_t*)(&tempRx), 1, 100);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_SET);
return (tempRx & 0x7FF);
}
Please help to solve this issue. Thanks in advance.