3

I know that this question has been asked several times, anyway I didn't find and answer to my specific case:

IAR Embedded Workbench returs this warning on compiling:

"Warning [pe069] integer conversion resulted in truncation" on the line:

SPI2_Tx(DVC_CTR2,       0x1000);

where DVC_CTR2 is

#define DVC_CTR2                0x0F

and SPI2_Tx definition is

static void SPI2_Tx(uint8_t pAddress, uint8_t pData)

How can I resolve this warning? Thanks in advance!

gigapico00
  • 417
  • 1
  • 7
  • 24

1 Answers1

4

This is because you cannot transmit a two-byte value through SPI routine that transmits a single byte.

You should be able to do it with two separate calls:

SPI2_Tx(DVC_CTR2, 0x10);
SPI2_Tx(DVC_CTR2, 0x00);

If you must transmit 16 bits at once, look up a different routine that takes uint16_t.

Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523