What does FE_MOD do?

cancel
Showing results for 
Search instead for 
Did you mean: 

What does FE_MOD do?

259 Views
juanabelaira
Contributor III

I copied some SPI functions from a project to another. I got a warning related to type mismatch that brought me to the below declaration in spi_15xx.h. Indeed, pTx and pRx are pointers to either 8 or 16-bit data. As the 'source' project had the FE_MOD symbol defined, I just defined it in the current one. I'm just wondering (as I couldn't find any documentation) what other things could this affect.

#ifndef FE_MOD
typedef struct {
uint16_t *pTx; /**< Pointer to data buffer*/
uint32_t TxCnt;/* Transmit Counter */
uint16_t *pRx; /**< Pointer to data buffer*/
uint32_t RxCnt;/* Transmit Counter */
uint32_t Length; /**< Data Length*/
uint32_t ssel; /**< Slave select bits */
uint16_t DataSize; /** < The size of a frame (1-16)*/
} SPI_DATA_SETUP_T;
#else // FE_MOD
typedef struct {
uint8_t *pTx; /**< Pointer to data buffer*/
uint32_t TxCnt;/* Transmit Counter */
uint8_t *pRx; /**< Pointer to data buffer*/
uint32_t RxCnt;/* Transmit Counter */
uint32_t Length; /**< Data Length*/
uint32_t ssel; /**< Slave select bits */
uint16_t DataSize; /** < The size of a frame (1-16)*/
} SPI_DATA_SETUP_T;
#endif // FE_MOD

0 Kudos
5 Replies

92 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Juan Abelaira,

    Because I didn't see your whole project, then I can't know what the detail meaning of your FE_MOD.

    But, just as you said, pTx and pRx are pointers to either 8 or 16-bit data.

    Actually, you can refer to your own chip, it seems you are using LPC15XX, from the user manual of LPC15xx, we can get that the SPI Receive Data and SPI Transmit Data  useful data is 16 bits.

pastedImage_1.png

pastedImage_2.png

So, I think you can don't care about FE_MOD, just defined it as :

uint16_t *pTx; /**< Pointer to data buffer*/
uint32_t TxCnt;/* Transmit Counter */
uint16_t *pRx; /**< Pointer to data buffer*/
uint32_t RxCnt;/* Transmit Counter */
uint32_t Length; /**< Data Length*/
uint32_t ssel; /**< Slave select bits */
uint16_t DataSize; /** < The size of a frame (1-16)*/
} SPI_DATA_SETUP_T;

Your two definition should used for two different chip's compatibility.


Have a great day,
Kerry

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

0 Kudos

92 Views
juanabelaira
Contributor III

Is not caring, is wondering why is undocumented. FE_MOD is not a symbol created by me, I wouldn't ask for help here in that case. It is used in the LpcOpen library. Apparently, if one wants to work with 8-bit data on SPI, it has to be manually defined, but I haven't seen it stated anywhere. I was lucky I found it because I review the warnings, otherwise I might have run into trouble.

0 Kudos

92 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Juan,

   Thanks for the point out.

   But I check the lpcopen code for lpc1549(lpcopen_2_20_keil_iar_nxp_lpcxpresso_1549), I didn't find this definition.

pastedImage_1.png

Please tell me what the lpcopen reversion you are using?

  


Have a great day,
Kerry

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

0 Kudos

92 Views
juanabelaira
Contributor III

I'm using same version, 2.20.

That's what I call 'code' (including header files and comments). Documentation aims higher and beyond. It tells programmers what code doesn't and there is usually a good deal. Finding details "in the code" is like realising a turn is dangerous after a couple of cars crashed.

0 Kudos

92 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Juan,

   Please give me your lpcopen full name, because I didn't find the FE_MOD keyword in my lpcopen version.


Have a great day,
Kerry

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

0 Kudos