Other Parts Discussed in Thread: AMIC110
Hello.
I try to use SPI in master mode to communicate. On TMDXICE110 board is a data connection on J5 pin 12 and 14. It is connect to SPI AMIC110. In my project I create task and try init and transfer cyclic data by SPI. But I not see pulses on pins J5 and U14 SN74CB3Q3245RGYR. Maybe I did not correctly initialize the driver?
It's my task.
#define MCSPI_INSTANCE 0
void Test_SPI_send(void){
SPI_v1_HWAttrs spi_cfg;
SPI_Params spiParams; /* SPI params structure */
SPI_Handle handle; /* SPI handle */
SPI_Transaction transaction; /* SPI transaction */
bool retVal = false; /* return value */
int i;
/* Get the default UART init configurations */
SPI_socGetInitCfg(MCSPI_INSTANCE, &spi_cfg);
/* Modify the default SPI configurations if necessary */
//spi_cfg.chnCfg[spi_cfg.chNum].dataLineCommMode = MCSPI_DATA_LINE_COMM_MODE_4;
/* Set the default UART init configurations */
SPI_socSetInitCfg(MCSPI_INSTANCE, &spi_cfg);
/* Init SPI driver */
SPI_init();
/* Default SPI configuration parameters */
SPI_Params_init(&spiParams);
spiParams.frameFormat = SPI_POL1_PHA0;
/* Uncomment below lines of code to test callback mode */
/* spiParams.transferMode = SPI_MODE_CALLBACK; */
/* spiParams.transferCallbackFxn = MCSPICallbackFxn; */
/* Open QSPI driver */
//handle = MCSPI_open(BOARD_MCSPI_SERIALIZER_INSTANCE, 1, &spiParams);
handle = SPI_open(BOARD_MCSPI_SERIALIZER_INSTANCE, &spiParams);
/* Initiate transfer */
spi_buff_out[0] = 0xAAU;
while(1){
/* Initiate transfer */
spi_buff_out[0] = 0xAAU;
transaction.count = 1U;
transaction.txBuf = &spi_buff_out[0];
transaction.rxBuf = NULL;
retVal = SPI_transfer(handle, &transaction);
for(i = 0;i< 65000; i++);
if(false == retVal)
{
UART_printf("\n Error occurred in spi transfer \n");
}
else
{
//UART_printf("\n All tests have passed. \n");
}
}
}
This is a piece of configuration code.
void My_Board_Init(void){
Board_initCfg boardCfg;
Task_Params taskParams;
Board_STATUS ret;
//Board_IDInfo board_info;
PRUICSS_Config *pruIcssCfg;
Error_Block eb;
Uint16 i;
//EpwmEtCfg -> intrEvtSource = PWMSS_EPWM_ETSEL_INTSEL_CTR_0;
for(i = 0; i<49; i++)
bufer_input_data[i] = 0;
for(i = 0; i<15; i++)
spi_buff_out[i] = 0;
Error_init(&eb);
boardCfg = BOARD_INIT_PLL| BOARD_INIT_MODULE_CLOCK | BOARD_INIT_DDR |
BOARD_INIT_ICSS_PINMUX | BOARD_INIT_UART_STDIO | BOARD_INIT_ICSS_ETH_PHY;
ret = Board_init(boardCfg);
if (ret != BOARD_SOK){
UART_printf("main: Board_init returned error code: %d\n", ret);
System_printf("main: Board_init returned error \n");
System_flush();
}
else{
UART_printf("main: Board_init complit \n");
System_printf("main: Board_init complit \n");
System_flush();
}
GPIO_init();
ret = PRUICSS_socGetInitCfg(&pruIcssCfg);
if (ret != PRUICSS_RETURN_SUCCESS){
UART_printf("main: PRUICSS_socGetInitCfg returned error code: %d\n", ret);
System_printf("main: PRUICSS_socGetInitCfg returned error \n");
System_flush();
}
else{
UART_printf("main: PRUICSS_socGetInitCfg complit \n");
System_printf("main: PRUICSS_socGetInitCfg complit \n");
System_flush();
}
pruIcssHandle = PRUICSS_create((PRUICSS_Config*) pruIcssCfg,PRUICCSS_INSTANCE_ONE);
.
.
.
.
Tell me what I'm doing wrong.