Quantcast
Viewing all articles
Browse latest Browse all 116964

Forum Post: RE: SPI mode for host

Nir,

Works for me. Check out the Command Execution Framework to see how EHIF commands are executed. NWM_CONTROL_ENABLE is using the ehifCmdExec(). 

[quote]

/** \brief Performs a CMD_REQ operation
*
* \param[in] cmd
* Command type (0x00 to 0x3F, see \c EHIF_CMD_XXXXX definitions)
* \param[in] length
* Number of parameter bytes (0 to 255)
* \param[in] *pParam
* Pointer to command parameter buffer
*
* \return
* EHIF status word at start of CMD_REQ operation (see \c EHIF_EVT_XXXXX definitions)
*/
uint16_t ehifCmdReq(uint8_t cmd, uint8_t length, const uint8_t* pParam) {

// Begin operation
EHIF_SPI_BEGIN();
ehifWaitReady();

// Send type/command code/parameter length, receive status word
uint16_t statusWord;
EHIF_SPI_TX(0xC0 | cmd);
EHIF_SPI_WAIT_TXRX();
statusWord = EHIF_SPI_RX() << 8;
EHIF_SPI_TX(length & 0xFF);
EHIF_SPI_WAIT_TXRX();
statusWord |= EHIF_SPI_RX();

// Send parameters
while(length--) {
EHIF_SPI_WAIT_TXRX();
EHIF_SPI_TX(*(pParam++));
}
EHIF_SPI_WAIT_TXRX();

// End operation
EHIF_SPI_END();
return statusWord;

} // ehifCmdReq[/quote]

How the SPI interface is set up on the MSP430 can be found in cc85xx_ehif_hal_board.h

Regards, 
Kjetil 

 


Viewing all articles
Browse latest Browse all 116964

Trending Articles