32 bit DSPI on K66

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

32 bit DSPI on K66

540 Views
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;
}

0 Kudos
Reply
1 Reply

451 Views
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 Kudos
Reply