Hi,
Suppose if i implement any module like SPI or CAN using Xgate, then the successful transmission or reception of these modules will trigger the Xgate interrupts, which then will update the corresponding buffers. But my doubt is how does the s12x processer know that the new data is available? As I am doing all the processing at the s12x end. Do i have only the option of polling the shared data? Is it a disadvantage of
implementing in Xgate? Or do i have any method to trigger the s12x when new data is available?
Thanks in advance,
Solved! Go to Solution.
Hi rahul,
please looked at the example code supplied with the CodeWarrior installation? In the directory {CW5.1 install}\(CodeWarrior Examples)\HCS12X\HCS12X_XGATE_SoftwareRequest is an example program that demonstrates communications between the HCS12X core and the XGATE, via Software Request interrupts. That might not be exactly what you're looking for, but it would be a starting point.
Also have a look at AN3144 which contains an example showing the sharing of a simple buffer.
does this answer your question?
Have a great day,
Zhang Jun
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Rahul,
Here is short video that demonstrates how interrupt driven communication between the XGATE and the CPU works:
The video was very useful and cleared lot of my doubts, thank you so much.
hi Rahul,
Attached is the sample code including how to share data in both XGATE and CPU. This is a simple project with three kind of objects :
Here is something you need to pay attention:
Can this help you?
Have a great day,
Zhang Jun
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Zhang Jun,
Thankyou for the reply. But my doubt is, I implemented CAN using Xgate interrupts. So, when a new message comes the Xgate interrupt is triggered and the common buffer between S12x and Xgate is updating, but S12x does not know that new message has received and it needs to keep polling the buffer. Is it the correct way of implementation? Or is there any way that i can inform both S12x and Xgate at the same time that new message has arrived and data is updated? I don't know if i explained my question properly?
Hi rahul,
please looked at the example code supplied with the CodeWarrior installation? In the directory {CW5.1 install}\(CodeWarrior Examples)\HCS12X\HCS12X_XGATE_SoftwareRequest is an example program that demonstrates communications between the HCS12X core and the XGATE, via Software Request interrupts. That might not be exactly what you're looking for, but it would be a starting point.
Also have a look at AN3144 which contains an example showing the sharing of a simple buffer.
does this answer your question?
Have a great day,
Zhang Jun
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
thank you very much. Yes now i understood.
you are welcome!