This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AN099: Help to fix [PE069] Integer conversion resulted in truncation

Hi guys!

I have a project about transmit and receive audio signal use RF. Following AN099 code example, i have warning

[PE069] Integer conversion resulted in truncation 


SET_WORD(DmaDesc1_4[3].DESTADDRH, DmaDesc1_4[3].DESTADDRL, audioOut[1]);
SET_WORD(DmaDesc1_4[3].DESTADDRH, DmaDesc1_4[3].DESTADDRL, audioOut[0]);

with define in below:

#define AF_LEN  96

#define AF_BUF_SIZE AF_LEN 

extern UINT16 __xdata audioOut[2][AF_BUF_SIZE];     // Audio Out (playback) Buffer

#define SET_WORD(regH, regL, word) \
do{ \
(regH) = UPPER_BYTE((word)); \
(regL) = LOWER_BYTE((word)); \
}while(0) 

extern DMA_DESC __xdata DmaDesc0;
extern DMA_DESC __xdata DmaDesc1_4[];

typedef struct {
BYTE SRCADDRH;
BYTE SRCADDRL;
BYTE DESTADDRH;
BYTE DESTADDRL;
BYTE VLEN : 3;
BYTE LENH : 5;
BYTE LENL : 8;
BYTE WORDSIZE : 1;
BYTE TMODE : 2;
BYTE TRIG : 5;
BYTE SRCINC : 2;
BYTE DESTINC : 2;
BYTE IRQMASK : 1;
BYTE M8 : 1;
BYTE PRIORITY : 2;
} DMA_DESC;

Please help me  with this problem, thanks!

  • Hi Nguyen,

    This is probably a warning because the function LOWER_BYTE() casts a WORD to a BYTE. This is intentional, which is why it's a warning and not an error. It's warning you that casting from a word to a byte results in truncation.

    #define UPPER_BYTE(a) ((BYTE) (((WORD)(a)) >> 8))
    #define HIBYTE(a)     UPPER_BYTE(a)
    
    #define LOWER_BYTE(a) ((BYTE) ( (WORD)(a))      )
    #define LOBYTE(a)     LOWER_BYTE(a)
    

    Sinnce there's another function to get the upper byte, you're fine.

    Regards,

    Daniel

  • Thanks for your help!

    Following AN099, i can transmit and receive audio microphone signal but the distance is too short ( about 5 meters). Now I want to increase the transmission distance as far as possible, i think problem is data rate, deviation and RX filter BW, i try to use SmartRF Studio to change registers and configured in code  but it can not work property, The CC1110 and CC1111 cannot be connected to each other, so the transmitted audio signals cannot be output to the speakers, can you give suggestions to fix this problem. Besides, I don't know the CC1110 can transmit and receive signals at the same time or can only transmit / receive signals. Hope your response soon!

  • Nguyen,

    Are you saying you changed settings in SmartRF Studio and now the devices won't connect? What did you change in SmartRF Studio?

    Regards,

    Daniel

  • Daniel,

    I wanted to increase the audio signal transmission distance as much as possible so I tried changing data rate, deviation, RX Filter. By changing the registers MDMCF G4, MDMCF G3, DEVIATN based on SmartRF Studio, some prices The value I changed was the data rate: 38.4 kbaud, DEV: 20kHz, RX Filter: 100kHz on both the receiver and the transmitter but they were not connected (When tested by SmartRF on CC1111 receiver, CC1110 signal is still transmitted with RSSI with value approximately -80dbm But when trying to transmit between CC1110 and CC1111, there is no audio signal and the signal LED on CC1111 flashes - it means CC1111 is not receiving the signal). Besides, I try to change Modulation Format to MSK with data rate value: 300kbaud, RX Filter: 450kHz, the transmission distance is longer. So how should I change to be able to transmit the furthest signal.

    Thank you!

  • Nguyen,

    I would recommend looking at the predefined radio configurations in tw_rf.c in the CC1110 project as a basis for your settings. 

    This is very old example, and was likely only characterized with the default settings. Here are some additional resources that may help you: 

    Instead of changing lots of settings all at once to try to maximize range, you may want to change RF settings one at a time to isolate what is causing your issues.

    Regards,

    Daniel

  • Daniel, 

    After reading both your submitted documents and the TI's documents, I currently see the data rate set to 300kbaud, so I thought it was necessary to lower the data rate in order to increase the transmission distance. By using SmartRF studio to look at the values for the registers and then put those values into the codes of both cc1110 and cc1111, with data rates > 200 kbaud, the receiver still receives the signal and the transmission distance increases. . However, when the data rate is < 200 kbaud, the receiver circuit is not receiving the signal, can you help me to solve this problem. Besides, when changing other values such as bandwidth, deviation, ..., the receiver circuit does not receive the signal. Thanks!

    Regards,

    Nguyen

  • Which hardware are you using?

  • I use CC1110 as transmitter according to AN099 and use CC1111 USB Dongle for receiver

    I think the code has a problem:
    // data rate = 300 kbaud, sample rate = 12 kHz:
    // packet length (bytes) = 2 * 54 + 4 + 4 + 2 + 3 = 121 bytes
    // packet length (usec) = 121 * 8000/300 = 3226.7 usec
    // LISTENFORMASTER = 3826.7 / 29.538 = 130


    #define FRAME_TIMEOUT_DEFAULT 161 // (T2CT) Timeout = 161 * 29,538 us = 4,756 msec
    According to the calculation, use sample rate 12kHz, but define in the sample rate is 16kHz and I don't see the value of FRAME_TIMEOUT_DEFAULT not assigned to any registers.

    www.ti.com/.../SWRA368

  • If you just get 5 m range this is a clear indication of something wrong with the design. Go through  and see if you are able to find the reason for the poor range.  

  • TER, 

    Thanks for your help, if i want to continue working on audio transmission project , can you give advice on chip and application note

    Regards,

    Nguyen

     
  • Meaning that you want to use something else than CC1110? 

    The best suited for audio on sub 1-GHz is to use dev.ti.com/.../node