Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN periodic transmit message with different modes using Frame API's

I want to transmit a CAN message periodically using Frame API's. I am able to send messages which dont have modes inside the message. For some messages having multiplexer in ".ncd " files and inside that multiplexer having different modes. Now in order to send all the modes of that message periodically by configuring them once by using Frame API's i did not  find a way. I am able to send messages but the last updated mode is only sent periodically. Is there any way that CAN message having different modes can be sent periodically, updating all modes periodically automatically using Frame API's.
0 Kudos
Message 1 of 5
(7,227 Views)

Hello Kpraveen,

 

You could set the period for N*Period, N being the number of modes.  You just need to make sure your application changes the modes fast enough to update each periodic frame.

 

For example, say you have 2 modes and the frame's period should be 10ms.  That means that you would like that frame to go out twice every 10ms, updating mode 1 and then mode 2.  So, that means that the frames period can be 5ms. 

 

1.  It will start by updating mode1

2.  5ms later, it will update mode2

3.  5ms later it will update mode1 again

...

 

mode 1 really has a  period of 10ms...

 

You just have to make sure that you can update the frame fast enough, or switch between modes fast enough, or you will send the same mode twice.

 

Let me know if this helps, or if I an not understanding this properly.  Have a great day.

O. Proulx
National Instruments
www.ni.com/support
0 Kudos
Message 2 of 5
(7,163 Views)

Prolux,

 

   The solution provided by you makes me to move out of using the Onboard clock of CAN module. This makes the processor to take more memory. What i am able to achieve is, i am able to send the periodic messages by configureing them once and based on the onobard clock the next time onwards they are sent automatically, which makes my job much more easier and as it uses onboard clock, the processor memory taken for running is low and even with the timing issuesit almost perfect. By changing the code according to your solution, there will be timing issues.

Now in my application what happens is as we can create only one objectID, though i send the data two different times at the start itself, only the last sent data is present which is being sent out periodically.

So what i wanted  was while making the  objectID for a perticular message ID which has modes, can we not create same number of  copies of objectID's as number of modes and send them periodically by using onboard clock.

 

0 Kudos
Message 3 of 5
(7,144 Views)

Hello Kpraveen,

 

I meant to configure your objects the same way, using the hardware (onboard clock) for the period.  However, you can double the period and modify your data in your program.  If your program is running faster than your period, you should have no problem updating the value before the hardware sends it out.  

 

The frame API is a low level API.  It does not know anything about modes...All it gives you are all the raw frames, so you have to manipulate the frames to do what you want.  

 

What kind of hardware do you have?  If you have PCI/PXI hardware, you could look into using the channel API, which supports mode dependant messages and different rates.

 

Have a great day.

O. Proulx
National Instruments
www.ni.com/support
0 Kudos
Message 4 of 5
(7,138 Views)

We use PXI chassis.  

 

I am still not able to observe two different data present on the CAN bus for the same message ID.

Could you please if possible send the code which makes to send the different data for the same message ID to send periodically by configuring it only one and using onboard clock, so that i can compare with my code and check out what exactly i am missing out.

 

Thanks.

Praveen.

0 Kudos
Message 5 of 5
(7,103 Views)