Other Parts Discussed in Thread: C2000WARE
Hi team,
Here's an issue from the customer may need your help:
The customer is going to use 1x mode, but no response occurs when the com bit in the 02 register is set. The default value of register 03 of this chip does not have a lock register and writes should be normal, but the actual value output after writing does not match the theoretical value in the manual.
But SPI communication does not read the register data. However, from the output of the chip, register 2 should be written in. The next few current related parameters are not configured either.
Here is the configuration code:
void SPI_Write(uint16_t addr, uint16_t data) { uint16_t commandword = ((addr << 11) | data); HAL_GPIO_WritePin(M_CS_GPIO_Port,M_CS_Pin,GPIO_PIN_RESET); HAL_SPI_Transmit(&hspi2,(uint8_t *)&commandword,1,20); HAL_GPIO_WritePin(M_CS_GPIO_Port,M_CS_Pin,GPIO_PIN_SET); HAL_Delay(5); } void SPI_Read(uint16_t addr) { HAL_GPIO_WritePin(M_CS_GPIO_Port,M_CS_Pin,GPIO_PIN_RESET); uint16_t commandword = (0x8000 | (addr << 11)); HAL_SPI_Transmit(&hspi2,(uint8_t *)&commandword,1,20); //HAL_SPI_Receive(&hspi2,(uint8_t *)&commandword,1,20); HAL_GPIO_WritePin(M_CS_GPIO_Port,M_CS_Pin,GPIO_PIN_SET); HAL_Delay(5); } SPI_Write(0x03,0x1BFF); SPI_Write(0x02,0x1052); SPI_Write(0x03,0x1EFF);
So the customer would like to know why the data cannot be read and what parameters should be set? Thanks.
Best Regards,
Cherry