Hi,
I am trying to interface 2 absoulte angle encoder chips(SPI) to SPI port of TMS320F28035. Since one of SPI of 28035 has been assigned to a fixed task, I have to use another SPI of 28035 connecting to the 2 encoder chips.
Just check if this method is workable or not:
--Hardware : the 2 encoder chips use the common CLK,MISO and MOSI with 28035's SPI, and 2 GPIOs of 28035 are used as chip select pins to ensure only one encoder chip is selected at any one time.
--Code: SPITX is operated in main loop and chip selecting is done by seting GPIOs either low or high while SPIRX interrupt routines recieve the data sending from the 2 encoder chips.
If this approach is funcational OK how to distinguish one encoder data from another as RX buffer is common used by the 2 streams. Are there any other better way to received the 2 way data through one SPI?
Harvey,
That is exactly how I would implement this design in hardware.
In regard to software, you should know how many bytes you are sending or receiving from each encoder. You should be able to use this information to pull the data from the buffer and separate it out. I can't think of any better ways to implement this.
Trey
Trey German
C2000 Applications
Trey,
Sorry for the late reply as I was out of office in past days. Thank you for your input! The 2 encoder chips are identical thus there is no way to separate the data by number of bit.
I am also referring to the thread: http://e2e.ti.com/support/microcontrollers/tms320c2000_32-bit_real-time_mcus/f/171/t/171156.aspx
it helps a lot, however how to ensure the data from 2 encoders are not mixed up is still an open issue.
Harvey Wangchip select pins to ensure only one encoder chip is selected at any one time ... how to distinguish one encoder data from another as RX buffer is common
Surely, if only one chip is selected at a time, then only that chip can send data - so you know exactly which encoder the data came from?!