STM32F429ZI interface to GEN4-FT813-CTP-CLB:
Everyone,
Posting for the first time here. We've been working with a 4d display that's based on an FT813 IC. The issue that we came to so far is the following.
- 0x7C during Initialization is never detected although, it is detected from MISO. This is read on the logic analyzer. So my thinking is that the FT813 is awake and communicating to the Host.
Our setup for FT813 is default : Internal CLK, SPI is at 4Mhz, Pol 0 Pha 1 , STM32 Core Clock is 16Mhz.
As I debug the FT813memRead8 function it transmits the REG_ID (0x302000)address however during the SP Receive, we never receive 0x7C.
Only when we added an element to return &ftData8[2]; do we receive anything at all. Yet and still it never display's 0x7C that's on the host (MISO). Therefore, we stay stuck at
while (FT813memRead8(REG_ID) != 0x7C) //we should be reading chip ID from C0000 - C0003?
{
}
I have personally worked as a firmware engineer contractor for the DOD but, I have never been involved with starting any of the displays.
I tried contacting 4d and github but, porting to stm32 doesn't help our issue.
If anyone could provide a light to give me knowledge of our issue it would be greatly appreciated!
We are transmitting and receiving but on other devices but, we we aren't we receiving 0x7C keeps us extremely baffled at this point and time.
Thanks in advance!
SAMPLE CODE
while (1) //initialize the display
{
HAL_GPIO_WritePin(GPIOD, FT813_PD_N_PD14, GPIO_PIN_RESET); //LOW, INITIALLY THE PD_N PIN IS SET TO NO PULL UP OR PULL DOWN.
HAL_Delay(30);
HAL_GPIO_WritePin(GPIOD, FT813_PD_N_PD14, GPIO_PIN_SET); // BE HIGH NOW
HAL_Delay(30);
HAL_GPIO_WritePin(GPIOD, FT813_CS_N_PD13, GPIO_PIN_SET); //initially make low
FT813cmdWrite(FT813_ACTIVE,0x00); //set active address, data
// ITM_Port32(31) = 1;d
HAL_Delay(700); //minimum of 300ms
//****************************************************************************************************************************
//***************************************************************************************************************************
// ITM_Port32(31) = 2;
while (FT813memRead8(REG_ID) != 0x7C) //are we reading chip ID from C0000 - C0003?
{
}
MEMREAD8
unsigned char FT813memRead8(unsigned long ftAddress) // Compose the command and address to read
{
HAL_GPIO_WritePin(GPIOD, FT813_CS_N_PD13, GPIO_PIN_RESET); //Transactions take place with CS_N low.
unsigned char *ftData8[2] = {0x00}; // start up with 0 // Place-holder for 8-bits being read
unsigned char cTempAddr[3] = {0x00}; // start up with 0 // FT813 Memory Address
unsigned char *cZeroFill = ZERO; // Dummy byte
//0x10/0x12(FT813/FT813
cTempAddr[2] = (char) (ftAddress >> 16); // Compose the command and address to send
cTempAddr[1] = (char) (ftAddress >> 8); // middle byte
cTempAddr[0] = (char) (ftAddress); // low byte
for (int i = 2; i >= 0; i--)
{
HAL_SPI_Transmit(&hspi1, &cTempAddr[i], 1, 0); // Send Memory Read/Write plus high address byte
//TIMEOUT MAYBE TOO SHORT!! BYTE TOO!
}
HAL_SPI_Transmit(&hspi1, &cZeroFill, 1, 0); // Send dummy byte
for (int j = 0; j < sizeof(&ftData8); j++) // Start with least significant byte
{
HAL_SPI_Receive(&hspi1, &ftData8[2], 1, 100); // Receive data byte
}
// Set chip select high
HAL_GPIO_WritePin(GPIOD, FT813_CS_N_PD13, GPIO_PIN_SET);
return &ftData8[2]; // Return 8-bits
}
SPI SETUP
static void MX_SPI1_Init(void)
{
/* USER CODE BEGIN SPI1_Init 0 */
/* USER CODE END SPI1_Init 0 */
/* USER CODE BEGIN SPI1_Init 1 */
/* USER CODE END SPI1_Init 1 */
/* SPI1 parameter configuration*/
hspi1.Instance = SPI1;
hspi1.Init.Mode = SPI_MODE_MASTER;
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
hspi1.Init.NSS = SPI_NSS_SOFT;
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_4;
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hspi1.Init.CRCPolynomial = 10;
if (HAL_SPI_Init(&hspi1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN SPI1_Init 2 */
/* USER CODE END SPI1_Init 2 */
}
GPIO BASIC ILLUSTRATION
/*Configure GPIO pins : FT813_CS_N_PD13_Pin FT813_PD_N_PD14_Pin */
GPIO_InitStruct.Pin = FT813_CS_N_PD13_Pin|FT813_PD_N_PD14_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
I tried
