[f28335] I2C transmit status
7 ビュー (過去 30 日間)
古いコメントを表示
Hi
I'm trying to program the DSP F28335 using simulink.
I want the program to send the numerical data (either 0 or 1) via the I2C transmit block. The I2C should send the data and received by the connected arduino.
I also would like to check whether the I2C is really send the data so I checked the "output transmitting status" option in the block.
However, when I run the program the status displays the number "5254" which I don't know what this value means. Also the arduino seems does not receive the transmitted data. I tried look up in "help", but it shows no explanation on the number.
Could you please suggest me the meaning of 5254 status and how can I check whether the I2C block is working or not?
Thank you
JJ
![Capture.JPG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/200502/Capture.jpeg)
![Capture1.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/200503/Capture1.png)
![Capture2.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/200504/Capture2.png)
0 件のコメント
回答 (2 件)
Venkatesh Chilapur
2019 年 1 月 10 日
Hi,
Please refer to below link:
The status value is the value as contained in the device I2C status register.
"Status values from the I2C status register (I2CSTR)."
You can decode the status by comparing the bitfields from the I2C status register to the value '5254'.
You can also refer the I2C examples for more information around these blocks.
Regards,
Venkatesh C
0 件のコメント
Venkatesh Chilapur
2019 年 3 月 27 日
Hi,
Please note when trying to use the I2C Tx and Rx blocks in an implementation for reading multiple bytes of data from slave, one needs to taken in to account the sequencing of the I2C Tx and Rx blocks execution. The reason for this to be done is, the I2C Tx block tries to first set the register address with slave from which to read the value and while this operation is active at the device level(I2C module is shifting the FIFO register content out on bus) the I2C Rx block would get executed. Since the success of I2C Rx block depends on the successful completion of operation I2C Tx block at hardware level, so a small delay is required before I2C Rx operation can be initiated.
There are multiple ways to achieve the same.
- A small software delay can be introduced between I2C Tx block and I2C Rx block and block priority can be set such that order of execution of these blocks follows this: - > I2C_Tx->Delay->I2C_Rx. An implementation of the same can be found in our example model: c28x_i2c_eeprom - under 'EEPROM Data Read' subsystem.
- You can also configure the I2C_Tx block to execute at the end of the current of cycle, such that the data for read is ready for next cycle. The block priority of I2C_Tx block is lower(higher number) than I2C_Rx block thus keeping the I2C_Tx block in the end to keep device ready for read for next cycle. Please refer the example: c28x_i2c_sensor for more details.
- Lastly, you can configure the I2C receive interrupt and react on the interrupt to read the data. This eliminates the drawbacks of 2 approach we took above. While in 1st case we can get away with delay, in the 2nd case we are reading the delayed data. Please refer the model - c28x_i2c_eeprom_interrupt.
All above models are discussed in detail at the following page:
Regards,
Venkatesh C
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Run on Target Hardware についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!