I am urgently in need to Send a RTR CAN message from a MIAC in an project however as you will know / see below that the SetTXData does not allow us to set the RTR bit in the buffer configuration ,when the Buffer is send it is always send as a Standard or Extended message .
Therefore we can not send a STD or XTD CAN RTR message
I suppose in the CAN component properties it can also be done if the parameter is added there however this means that this specific Buffer will always be an RTR Message Buffer,I would think it is better if the parameter is avaialble when populating tit with DATA and we then have the option that the Buffer is a RTR frame buffer or not ,Please help me by adding this to the CAN compoment it is very urgent, I need to run this machine on 20.10.2022.
For the function name, search for "FC_CAN_SPI_CAN_Write" in the C code currently generated by your Flowcode project because the "_1" suffix may be different.
The "0x35" is, I think, the address of the TXB0DLC register. And the "0x4F" sets the RTR bit and sets the data byte count to 8. I assume the data count needs to be 8. You will need to set this back to "0x0F" again to sent 'normal' messages.
I have not tried this myself and it might not work for you, but hopefully it will.
You're correct - it's probably better to have an option for RTR in the component itself. But hopefully my suggestion gives you a workaround until the component has been redeveloped.
I understand this Thank you so much.
I could only find the following in my C Code it seems your suggestion is correct with " FC_CAN_SPI_CAN_Write_1" Please just check for with your experienced eyes
If you were using internal CAN then I would suggest doing the following to allow you to control the RTR bit, I don't want to do too much immediatley as I don't want to break other users programs and I need to get a better grip on this bit and what it does.
To have the RTR bit clear sent the data count value as normal when calling the SetTXData macro. Range 0-8.
To have the RTR bit set simply send the data count | 0x40 and this will set the RTR bit in the register for you. Range 64-72.
Might also work for the external CAN, I'll see if there's a mask on the data cound size that would cause a problem.
Let us know how you getting on.
edit, looks like my hack should also work for the external CAN mode.
Thank you for your reply ,
I will try tomorrow on the actual machine,
I am surprised that the component does not handle RTR message as it is a part of the CAN standard and is used quite a bit in industry
anycase if this will solf my problem I will be ver happy