CAN Bus

9 years 7 months ago #29528831 by Pullance
CAN Bus was created by Pullance
Can anyone give me any pointers as to how to access CAN data on the Pi?

Is the CAN data part of the memory sync performed by the Daemon?

Is the CAN data buffered and if so is there any configuration and monitoring of the buffer possible (I.E to detect buffer overrun)

To start off I just want to retrieve the whole CAN bus data to the Pi for processing but in future I may likely want to be able to get the Pi to dynamically set filters on the CAN data being transferred. Later on a few send frames would be desirable.

Any help to get me going in the right direct would be greatly appreciated. FYI, My Linux knowledge is limited, never used Python but willing to try but do have experience in C (mostly PC based).

Please Log in or Create an account to join the conversation.

9 years 7 months ago #29528832 by Griffin Baker
Replied by Griffin Baker on topic CAN Bus
Have you downloaded and read the datasheet? It has some information regarding the can bus.

dev.roboteq.com/dev1/index.php/roboteq-p...ters/rio-ahrs-detail

The datasheet for this and the non AHRS are the same.

Page 17 of the data sheet gives you the commands for doing queries.

Please Log in or Create an account to join the conversation.

9 years 7 months ago #29528837 by Pullance
Replied by Pullance on topic CAN Bus
Dear Griffin,

Thank you for your reply.

I have read the datasheet. Although, I have to be honest, I haven't done any real experimenting.

From what I can tell, the commands on page 17 are referring to the serial commands that can be sent to the RIO from the PI and I assume the results are then returned over serial. This would require the PI to 'react' to all the CAN bus data which would, I think, effectively turn the RIO into a CAN to Serial converter.

What I was wondering was if the CAN bus data was transferred by the DMA transfer process managed by the demon like the I/O status. There doesn't appear to be any commands in the table in page 14 that would suggest that it does.

If the CAN data was being 'synced' by the DMA demon then I was wondering if there was a buffer and thus how this buffer can be configured and monitored (for buffer overruns etc).

I wanted to ask these questions before I went down the route of developing an app by purely experimentation alone in case I was going down the wrong path.

Many Thanks

Please Log in or Create an account to join the conversation.

9 years 7 months ago #29528838 by roboteq
Replied by roboteq on topic CAN Bus
CAN is not yet implemented in RIO. We do not have a schedule of if or when given that this feature has received very little attention from users.

However the plan was to use the Raspberry's serial port in order to communicated with the MCU on RIO. The serial data was to then be parsed and send to CAN.

Please Log in or Create an account to join the conversation.

9 years 3 months ago #29529245 by hoylet
Replied by hoylet on topic CAN Bus
Hi

I would also like to handle CAN data.

I am developing a Java application and I would like to receive raw CAN data. I bought a RIO AHRS as the website states that there is a CAN interface.

Am I to understand that I cannot rx CAN data ? or is just that the libraries do not provide access to the CAN/shared memory ?

If there are no C library api functions (to accessed by Java via JNI) I guess I can issue serial CA query commands to the RIO and parse the text results. I propose to use pi4J to provide a simple serial interface for Java. How to I access the SPI to communicate with the RIO, what is the device called ie ttynn ??

Many thanks

Please Log in or Create an account to join the conversation.

9 years 3 months ago #29529246 by hoylet
Replied by hoylet on topic CAN Bus
Managed to query RIO via SPI using Pi4J.

What is the max baud rate supported by the SPI interface and how do I configure the baud rate.

Thanks

Please Log in or Create an account to join the conversation.

9 years 3 months ago #29529253 by opal
Replied by opal on topic CAN Bus
@hoylet,

Thanks for your interest in RIO.

You were right expecting RIO to provide CAN functionality. But the API and firmware are still under heavy development. So, it will come. CAN is really high in our list of features to improve/bring to the platform. We will announce newly added/extended functionality soon, here on this forum topic. So, please come often or stay subscribed to forum updates.

Thanks for your patience and understanding.

Please Log in or Create an account to join the conversation.

9 years 3 months ago #29529254 by opal
Replied by opal on topic CAN Bus
@hoylet,

About hawing pi4J-based serial interface bundle - good idea! We were thinking about providing bundles for more languages, other than Python. .NET/Mono is also in the list.

About SPI access - the original plan was to provide API "hiding" the communication layer (SPI in this case) from the consuming application. If you have the need to use SPI to communicate with RIO directly - this means API is not complete/usable enough. So, API should be extended. Please share your needs and we will consider extending API rather than encouraging our customers using SPI directly. For the end-user it means portability (to some extent). If we change from SPI to something else one day - consuming application should still work.

Please Log in or Create an account to join the conversation.

9 years 3 months ago #29529255 by hoylet
Replied by hoylet on topic CAN Bus
Hi

Sounds good I eagerly await api CAN functions, especially Java.

In the meantime I will use Pi4J to access the CAN functionality.

I must say pi4J appears to be very good, Serial IO is very straightforward.

Do you have an approximate time frame for implementing CAN api functions C or Java.

Thanks

Please Log in or Create an account to join the conversation.

8 years 6 months ago #29530224 by mjepson
Replied by mjepson on topic CAN Bus
Any news on this? We are building an AGV with several sensors (laser, sonar, etc.) with two magnetic guide sensors. Because we are really running low on in-/outputs on the RIO board, we are trying to get the two guide sensors on a CANbus.
Programming is done through Python (2.7 since rioboard.so does not work in Python3), but there do not seem to be any API call for receiving/sending CANbus messages? Is it even possible to get the guide sensors and RIOboard to communicate through the CANbus?

Please Log in or Create an account to join the conversation.

Moderators: opal
Time to create page: 0.072 seconds