32 bit DSPI on K66

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

32 bit DSPI on K66

846 次查看
ahmedtolba
Contributor I

How would I send 32bit data values using SPI of K66.. here is my attempt. The problem is only some parts of the 32bits are shown in the scope

status_t ADF4158_GenericWriteReg(pll_register_t reg, pll_params_t *params)
{
dspi_command_data_config_t command;
uint32_t value;

if(reg >= kPLL_MAX)
return kStatus_Fail;

/* obtain formatted register value */
value = ADF4158_GetFormattedRegValue(reg, params);

PRINTF("Writing Register R%d with value 0x%08X\r\n", reg, value);

/* Define Chip Select */
command.whichCtar = spiCtar;
command.whichPcs = spiPcs;
command.isPcsContinuous = true;
command.isEndOfQueue = false;
command.clearTransferCount = false;

/* upper 16 bit */
DSPI_MasterWriteDataBlocking(spiBase, &command, (uint16_t)(value >> 16U));

/* lower 16 bit */
command.isPcsContinuous = false;
DSPI_MasterWriteDataBlocking(spiBase, &command, (uint16_t)(value & 0x0000FFFFU));
ADF4158_DelayFunc();

return kStatus_Success;
}

标记 (3)
0 项奖励
回复
1 回复

757 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

The K66 SPI master using SPIx_PUSHR(PUSH TX FIFO Register In Master Mode) register transfers 16 bits of data and 16 bits of command information one time.

So, the 32bits data should be split for two times to transfer with suitable command info (each time 16bits of data).

Wish it helps.


Have a great day,
Mike

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复