Part Number: TDA4VM
Tool/software:
Hi TI,
due to lack of SPI instances, we need to use OSPI Controller (MCU_OSPI1) for standard SPI communication. I configured the controller the following way:
uint32_t spiInstance = 1; // MCU_OSPI1 uint32_t spiChannel = 1; OSPI_Params spiParams; OSPI_v0_HwAttrs spiConfig; OSPI_Params_init(&spiParams); spiParams.transferMode = OSPI_MODE_BLOCKING; spiParams.bitRate = 10000000; // SPI Frequency in Hz spiParams.frameFormat = OSPI_POL0_PHA0; // SPI Mode 0 spiParams.mode = OSPI_MASTER; spiParams.dataSize = 8; // 8 Bit Interface spiParams.transferCallbackFxn = nullptr; OSPI_socGetInitCfg(SPI_OSPI_DOMAIN_MCU, spiInstance, &spiConfig); spiConfig.chipSelect = spiChannel; spiConfig.intrEnable = false; spiConfig.operMode = OSPI_OPER_MODE_CFG; spiConfig.phyOpMode = CSL_OSPI_CFG_PHY_OP_MODE_DEFAULT; spiConfig.dacEnable = false; spiConfig.phyEnable = false; spiConfig.dtrEnable = false; spiConfig.xferLines = OSPI_XFER_LINES_SINGLE; spiConfig.frmFmt = CSL_OSPI_CLK_MODE_0; configClk(OSPI_MODULE_CLK_166M, true, domain, instance); // Taken from OSPI Flash test code OSPI_socSetInitCfg(spiDomain, spiInstance, &spiConfig); OSPI_init(); OSPI_Handle spiHandle = OSPI_open(spiDomain, spiInstance, &spiParams);
As a test, I transfer the following data:
OSPI_Transaction transactionData; bool isSuccessfull; uint8_t transmitBuffer[3]; transmitBuffer[0]=0x11; transmitBuffer[1]=0x33; transmitBuffer[2]=0x55; transactionData.count = 3; transactionData.txBuf = &transmitBuffer; transactionData.rxBuf = nullptr; isSuccessfull = OSPI_transfer(spiHandle, &transactionData);
I get the following signals (Green: SCLK, Blue: MOSI):

There are following problems with the resulting signals:
- CLK frequency is 5.2 MHz instead of 10 MHz (configured via spiParams)
- A Data Frame is not limited to 8 Bit
- There is one additional 8 Bit data frame appended (32 bit instead of 24)
- Only the first 8 bit are transmitted correctly
The TRM mentions, that SPI Legacy mode
"allows the user to issue any FLASH instruction to the device, but does place a heavy software
overhead in order to manage the fill levels of the FIFO’s effectively."
But there is little explanation on how to implement SPI Legacy mode, except of setting bit 8 (ENB_LEGACY_IP_MODE_FLD) in OSPI_CONFIG_REG register.
My questions are:
If I want to achieve standard SPI behaviour, do I have to use legacy mode? Can I fix the above mentioned problems (1. - 4.) also in non legacy mode?
If I have to use legacy mode, is there a more detailed description on what to do?
Thanks for your help and best regards,
Felix
