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.
Hi - i have a crazy question. First, i am implementing EtherCAT on the F28379D and am using the TMDSECATCNCD379D reference design. I am using the SPI interface. Everything is working fine (CoE, FoE, process data transfers - no issues).
But i ran into a byte vs word problem which got me looking at the memcpy function implemented in the C28xxsystem.c file. The function is called c28xx_memcpy(s1, s2, n) and is setup to copy n bytes from s2 into s1. But the <string.h> memcpy function works on 16-bit words. So the c28xx_memcpy function simply calls memcpy with n divided by 2. And, in my mind, this should work fine except when n is odd.
So, assuming i am right, is TI assuming n is always even? And if so, how is that guaranteed?
I also checked in the ..\libraries\communications\EtherCat\f2838x\ssc_configuration\cpu1\f2838x_cpu1_system.c file and noted it uses the same logic.
Thanks for you help!
Brett
Brett,
Please expect some delay in response as the next three days are TI India holidays.
Hi Brett,
Your observation is correct. I looked at the API and it expects the incoming data is in multiple of words (16 bits) but length expressed in bytes.
Thanks,
Hi Ranjith - thank you for the quick response. Just a follow-up: When you say API, are you talking about an EtherCAT API (and therefore EtherCAT guarantees the function will only be called with n even) or a TI API (and therefore there is no guarantee the function will always be called with n even)?
Thanks!
Brett
Hi Brett,
I was referring to the TI wrapper API. Since C28x is not a byte machine, the function is expecting the data is in multiple of words.
Thanks,