Thank Yves for your reply
In the message name, I misspelled the Primer2 name board (and not Prima2 board)
According to the Codec (STw5094A) datasheet
¨
When power is first applied, the “power on reset” circuitry initializes STw5094A and puts it into the power down state. All the Registers are initialized as indicated in the Control Register description section. All the functions are disabled.
I guest the DX output should be in HI-Z by default.
I've be able to test the following code on the Master Primer2 with valid signals
on SPI2_SCK(JP2.7) and SPI2_MOSI(JP2.6) but on the Slave Prima2, the SPI2_MISO(JP2.5) remain quiet.
I connect both Prima2 board with straight wires via the external JP2 connectors:
JP2 Primer2 Master JP2 Primer2 Slave
JP2.8 --> JP2.8 --> (AUDIO_I2S2_WS)
JP2.7 --> P2.7 --> (AUDIO_I2S2_SCK)
JP2.5 --> JP2.5 --> (AUDIO_SPI_MISO)
JP2.6 --> JP2.6 --> (AUDIO_I2S2_SD)
Since both boards have the same 2.8 V level and i'm not sure is the WS pins
is necessary for chips select.
Here the soft on the SPI master Primer2, it sends the byte 0X55 at every delay:
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;
SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low;
SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
/* SPI_BaudRatePrescaler_8 --> 6.5 Mhz default value */
/* SPI_BaudRatePrescaler_16 --> 3.25 Mhz */
/* SPI_BaudRatePrescaler_32 --> 1.6 Mhz */
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_32;
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_InitStructure.SPI_CRCPolynomial = 7;
SPI_Init(SPI2, &SPI_InitStructure);
/* Enable SPI2 */
SPI_Cmd(SPI2, ENABLE);
GPIO_InitTypeDef GPIO_InitStructure;
/* Configure SPI2 pins: SCK, MISO and MOSI ---------------------------------*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* Configure SPI1 pins: SCK, MISO and MOSI ---------------------------------*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);
}
while (1)
{
/* Wait for SPI2 Tx buffer empty */
while (SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_TXE) == RESET);
/* Send SPI2 data */
SPI_I2S_SendData(SPI2, 0x55);
Delay(DELAYVAR_SMALLCHANGE);
}
}
and the soft on the SPI slave Primer2, it receive the byte 0x55 and resend it
to the masteer Primer2:
u8 ReturnData;
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
SPI_InitStructure.SPI_Mode = SPI_Mode_Slave;
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;
SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low;
SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
/* SPI_BaudRatePrescaler_8 --> 6.5 Mhz default value */
/* SPI_BaudRatePrescaler_16 --> 3.25 Mhz */
/* SPI_BaudRatePrescaler_32 --> 1.6 Mhz */
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_32;
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_InitStructure.SPI_CRCPolynomial = 7;
SPI_Init(SPI2, &SPI_InitStructure);
/* Enable SPI2 */
SPI_Cmd(SPI2, ENABLE);
GPIO_InitTypeDef GPIO_InitStructure;
/* Configure SPI2 pins: SCK, MISO and MOSI ---------------------------------*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
GPIO_Init(GPIOB, &GPIO_InitStructure);
while (1)
{
/* Wait for SPI2 Rx buffer empty */
while (SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_RXNE) == RESET);
ReturnData = SPI_I2S_ReceiveData( SPI2 );
/* Wait for SPI2 Tx buffer empty */
while (SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_TXE) == RESET);
/* Send SPI2 data */
SPI_I2S_SendData(SPI2, ReturnData);
}
}
I don't put the RCC_Configuration() and NVIC_Configuration() functions.
There something wrong on the Slave side but I can't find the problem.
Best Regards
JM