Page 1 of 1
					
				External CAN Component Missing Parameter
				Posted: Sun Oct 16, 2022 9:43 am
				by p.erasmus
				Dear Ben/Team.
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.
I appreciate your help  
 
			
		
				
			
 
						- P1.JPG (65.73 KiB) Viewed 6105 times
 
		
		
		
			 
From then Data sheet
			
		
				
			
 
						- P2.JPG (82.24 KiB) Viewed 6105 times
 
		
		
		
			  
			 
			
					
				Re: External CAN Component Missing Parameter
				Posted: Mon Oct 17, 2022 10:10 am
				by p.erasmus
				Dear Team,
I tried as a work around to set the RTR bit manually however it seems the TXBnDLC register are not in the definition file.
			
		
				
			
 
						- P1.JPG (92.66 KiB) Viewed 6082 times
 
		
		
		
			 
Thanks again for your help.
 
			 
			
					
				Re: External CAN Component Missing Parameter
				Posted: Mon Oct 17, 2022 11:08 am
				by Steve-Matrix
				Hi Peter,
It might work if you call the underlying function with a C icon similar to the following:
Code: Select all
FC_CAN_SPI_CAN_Write_1(0x35, 0x4F);
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.
 
			 
			
					
				Re: External CAN Component Missing Parameter
				Posted: Mon Oct 17, 2022 1:55 pm
				by p.erasmus
				Hi Steve,
Thank you for the sugestion ,Please help the byte count should be 1 so it is datalenght 1 and RTR set 
Thanks for your help However is it not better when this is allowed to be selected from the Component ?
			 
			
					
				Re: External CAN Component Missing Parameter
				Posted: Mon Oct 17, 2022 2:18 pm
				by Steve-Matrix
				Hi Peter,
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.
			 
			
					
				Re: External CAN Component Missing Parameter
				Posted: Mon Oct 17, 2022 2:41 pm
				by p.erasmus
				Hi Steve,
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 
Regards
			
		
				
			
 
						- P1.JPG (86.45 KiB) Viewed 6061 times
 
		
		
		
			  
			 
			
					
				Re: External CAN Component Missing Parameter
				Posted: Mon Oct 17, 2022 3:21 pm
				by BenR
				Hello,
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.
			 
			
					
				Re: External CAN Component Missing Parameter
				Posted: Mon Oct 17, 2022 3:58 pm
				by p.erasmus
				Hi Ben,
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  
 
Thanks again I will try 
Regards
 
			 
			
					
				Re: External CAN Component Missing Parameter
				Posted: Thu Oct 20, 2022 11:54 am
				by p.erasmus
				Dear Ben/Steve
Thank you for your help I managed to send a RTR Message 
just as an information
o 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.
This has no effect the bit is always 0 (do not know why  

 )
However Calling the SPI function did the job
 
Code: Select all
FC_CAN_SPI_CAN_Write_1(0x35, 0x4F);
Thank you so much to you guys