I posted some questions about the SHARC TWI_Slave a few weeks ago, and the issue were resolved.
Now when I keep developing my code, I found more questions about the TWI_Slave communication. In my code, the TWI_Slave receives command from a uC's TWI_Master and then feeds back the performing result which called Command-Feedback operation.. When I debugged the code, I got two more issues:
1. When I ran the code for one Command-Feedback operation, I found the code seemed perform two times Feedback Transmitting operations. For viewing the operation I use a counter to count the times of the Transmitting and also view the Feedback content. The attached Fig.1 shows my viewing. You can see the Feedback is the same with the received Command, but it was sent out two times (the Counter is 2 ). But in the Timing Diagram of the TWI, only one data was sent (please see the Fig.2). Problem is when the uC sent the 2nd Command, it still got the first Feedback. My question is why the TWI_Slave Transmitting was performed two times?
2. In the code, I added a SDRAM Check function. When the code called the SDRAM_Ch( ) in the TWI_Slave Receiving Operation (within the ISR), and then sent out the Feedback, the uC could not receive it and it's code not stopped (please see the Fig.3 in the attached file). If the TW_Slave Receiving Operation didn't call the SDRAM_chk(), the Feedback could be received by uC (please see the Fig.2). And not matter is the Feedback could be received, the TWI_Slave could perform the Feedback transmitting successfully. My question is why the SDRAM_Chk() calling could affect the TWI_Master's receiving?
Attached are my testing code that gets above two issue and the diagrams about the issues (I found when I pasted diagrams here, they got lost once I posted the message, so I put the diagrams into a Word file).
Would any one check my code especially the TWI_Slave ISR to see what's wrong with code? Should you need other information about my test, please let me know.
Thank you very much,