Other Parts Discussed in Thread: LAUNCHXL-F280025C, DRV8323, BQ76952
Tool/software:
Hi,
I have custom board which is based on launchxl-f280025c + boostxl-drv8323rs combo just with minor pins changed like EN, SOMI and SIMO pins
Custom Board | LaunchXL-F280025C + Boostxl-DRV8323RS | |
SPI-A Clock | GPIO_12_SPIA_CLK | GPIO_9_SPIA_CLK |
SPI-A (SOMI) | GPIO_13_SPIA_SOMI | GPIO_10_SPIA_SOMI |
SPI-A (SIMO) | GPIO_16_SPIA_SIMO | GPIO_11_SPIA_SIMO |
EN | GPIO_31_GPIO31 | GPIO_29_GPIO29 |
CS | GPIO_8_GPIO8 | GPIO_8_GPIO8 |
FAULT | GPIO_34_GPIO34 | GPIO_34_GPIO34 |
1. HAL_setParams -> HAL_setupGPIOs
inside this function, there's predefined symbol DRV_CS_GPIO, by default it's bypassed, here's my first question, where's CS pin set High and Low ? because inside DRV8323_readSPI and DRV8323_writeSPI function CS pin also bypassed ?
// M1_DRV_SCS #ifdef DRV_CS_GPIO GPIO_setPinConfig(GPIO_8_GPIO8); GPIO_writePin(8, 1); GPIO_setDirectionMode(8, GPIO_DIR_MODE_OUT); GPIO_setPadConfig(8, GPIO_PIN_TYPE_PULLUP); #else // M1_DRV_SCS (Use a wire->J2-18) GPIO_setPinConfig(GPIO_8_GPIO8); GPIO_setDirectionMode(8, GPIO_DIR_MODE_IN); GPIO_setPadConfig(8, GPIO_PIN_TYPE_STD); #endif // GPIO12->M1_DRV_SCLK* GPIO_setPinConfig(GPIO_12_SPIA_CLK); GPIO_setDirectionMode(12, GPIO_DIR_MODE_OUT); GPIO_setPadConfig(12, GPIO_PIN_TYPE_PULLUP); // GPIO13->SPIA_SOMI->M1_DRV_SDO* GPIO_setPinConfig(GPIO_13_SPIA_SOMI); GPIO_setDirectionMode(13, GPIO_DIR_MODE_IN); GPIO_setPadConfig(13, GPIO_PIN_TYPE_PULLUP); // GPIO16->SPIA_SIMO->M1_DRV_SDI* GPIO_setPinConfig(GPIO_16_SPIA_SIMO); GPIO_setDirectionMode(16, GPIO_DIR_MODE_IN); GPIO_setPadConfig(16, GPIO_PIN_TYPE_PULLUP); // GPIO31->M1_DRV_ENABLE* GPIO_setPinConfig(GPIO_31_GPIO31); GPIO_writePin(31, 1); GPIO_setDirectionMode(31, GPIO_DIR_MODE_OUT); GPIO_setPadConfig(31, GPIO_PIN_TYPE_STD);
2. HAL_MTR_setGateDriver -> HAL_setupGate :
both EN and CS assigned to gpioNumber_EN and gpioNumber_CS respectively
3. HAL_MTR_setGateDriver -> HAL_enableDRV -> DRVIC_enable :
EN pin set to 1 and DRV enable, Motor can spin and Identify.
inside this function DRV8323_readSPI(handle, DRV8323_ADDRESS_STATUS_0) & DRV8323_STATUS00_FAULT_BITS) != 0 can not tell if chip communicate is work or not because if SPI failed FAIL bit is 0
4. HAL_setupDRVSPI -> DRVIC_setupSPI
inside this function, for instant read control register 3, it should update drv8323Vars->ctrlReg03.all
but at the end it's remain 0
// Read Control Register 3
// all bit default value are 1, IDRIVEP_HS=1000mA, IDRIVEN_HS = 2000mA
drvRegAddr = DRV8323_ADDRESS_CONTROL_3;
drvDataNew = DRV8323_readSPI(handle, drvRegAddr);
drv8323Vars->ctrlReg03.all = drvDataNew;
5. as mentioned before, inside both DRV8323_readSPI and DRV8323_writeSPI has not CS select action because it's bypasses
#if defined(DRV_CS_GPIO)
GPIO_writePin(obj->gpioNumber_CS, 0);
GPIO_writePin(obj->gpioNumber_CS, 0);
#endif // DRV_CS_GPIO
Where's CS pin action take place ? what's went wrong ?
Danny