Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 20:48 24 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Anyone done CAN Bus communications

Author Message
Hans

Senior Member

Joined: 18/10/2022
Location: Canada
Posts: 116
Posted: 12:54am 25 Aug 2024
Copy link to clipboard 
Print this post

Hi All;

I tried to search for "can bus" in the forum but there are too hits on bus or can as in can't etc.

So I am asking if anyone has done any communications over can bus to talk to devices that use this protocol?

I need to understand how I can hook up a pico to experiment with talking to an automotive device.

This will be more of a hacking experiment in the end I suppose.

Any programming supplied would be much appreciated.

Thanks guys!

Hans ...
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2135
Posted: 02:12am 25 Aug 2024
Copy link to clipboard 
Print this post

If you copy:-

Site:thebackshed.com "can bus"

into your browser search bar there are a few threads that come up but appear to be for Arduino not MMBasic.

CSub LOG (last compiled for MMBasic v5.08.00 by @Disco4Now) can capture fast data streams in an array for later processing.

Another option is to use the ADC command to capture a stream of samples that can later be converted to data.
Edited 2024-08-25 12:14 by phil99
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 896
Posted: 02:34am 25 Aug 2024
Copy link to clipboard 
Print this post

I have been playing around with the MCP2515 CAN module and have a driver for it for MMBasic. It probably needs a bit more documentation on where to adjust for your environment but essentially needs the SPIOPEN and SPICLOSE routines adjusted for a Pico and set the appropriate CS pin.

See this item on fruitoftheshed where I have started to document it.

The Armmite F407 and Armmite H743 chips have a native CAN controller, the next release of MMBasic will expose these to MMBasic (i.e an MMBasic CAN command) so you will only need a transceiver chip such as the SN65HVD230 CAN Transceiver. SN65HVD230 CAN Transceiver
I have these working, just need to tidy up the documentation.

Gerry
Latest F4 Latest H7
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6779
Posted: 06:29am 25 Aug 2024
Copy link to clipboard 
Print this post

There used to be an official version of MMBasic that supported CAN bus. Wasn't it for the original Colour Maximite? You plugged the hardware for it onto Arduino-arranged sockets on the board. I think it was one of those things that got dropped as it took a lot of resources and was of limited interest. Geoff probably still has the info on it. There may be something on his site.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3194
Posted: 07:19am 25 Aug 2024
Copy link to clipboard 
Print this post

Many moons ago (in 2012) John Harding added support for the CAN protocol into MMBasic for the original Colour Maximite.  It was dependent on the CAN module integrated in the Microchip PIC32MX795F512L processor and I released it as a separate version to the standard version of MMBasic.

I know very little about the CAN protocol so I never tested it but quite a few people did use it and apparently it did a great job.  You can still download the firmware+documentation package which is buried in my website at https://geoffg.net/OriginalColourMaximite.html  (scroll down to the downloads section at the bottom).

Unfortunately, because it is dependent on the PIC32MX795F512L chip it will not work on the PicoMite.

Geoff
Geoff Graham - http://geoffg.net
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 857
Posted: 08:29am 25 Aug 2024
Copy link to clipboard 
Print this post

  disco4now said  I have been playing around with the MCP2515 CAN module and have a driver for it for MMBasic. It probably needs a bit more documentation on where to adjust for your environment but essentially needs the SPIOPEN and SPICLOSE routines adjusted for a Pico and set the appropriate CS pin.

See this item on fruitoftheshed where I have started to document it.

The Armmite F407 and Armmite H743 chips have a native CAN controller, the next release of MMBasic will expose these to MMBasic (i.e an MMBasic CAN command) so you will only need a transceiver chip such as the SN65HVD230 CAN Transceiver. SN65HVD230 CAN Transceiver
I have these working, just need to tidy up the documentation.

Gerry


This is just never-ending awesomeness    
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6779
Posted: 09:24am 25 Aug 2024
Copy link to clipboard 
Print this post

Thanks Geoff. My memory wasn't a complete disaster then. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
oh3gdo
Regular Member

Joined: 18/11/2021
Location: Finland
Posts: 47
Posted: 10:32am 25 Aug 2024
Copy link to clipboard 
Print this post

Hans

I did a Can device for car last January
It is here:
http://probyte.fi/Can7.jpg

It uses a PIC 18F26K80 compiler and it must work in the car.
I used CCS v5.115 c-compiler.

I reads with uart a data from other measuring device, but the customer needs that its customer knows that they have done it and they have used CAN before. The customer can't say what CAN address I can use.  

Anyway, it was a quite job to do the software.

There were too different similar messages, which must to turn CAN data, but they must first separate.  
The CAN data is very small and my input data was 32 bits long.

I needed a CAN measuring device, but first Swedish can device doesn't worked.
The second device worked.
Anyway after 1.5 months works it succeed, but the customer didn't get it work and send it back. We checked it and it worked well and send them to Paris.
Then the customer got it working.  

The software is a my customer, so I can give it, but I can do a new one.

 
Pekka Ritamaki oh3gdo@gmail.com
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 857
Posted: 12:09pm 25 Aug 2024
Copy link to clipboard 
Print this post

  disco4now said  
The Armmite H743 chips have a native CAN controller, the next release of MMBasic will expose these to MMBasic
Gerry


Hey Gerry, are we talking CAN FD or Classical?

Exciting stuff  
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 896
Posted: 12:44pm 25 Aug 2024
Copy link to clipboard 
Print this post

  PhenixRising said  

Hey Gerry, are we talking CAN FD or Classical?

Exciting stuff  

The H743 does support CAN FD but I have only developed the MMBasic syntax to set it up for Classic mode for now.
Latest F4 Latest H7
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 857
Posted: 01:01pm 25 Aug 2024
Copy link to clipboard 
Print this post

Just been reading about it

Downloaded "CAN Bus The Ultimate Guide", too big to upload here.

Claims of near-zero latency. I really need to investigate.
 
Hans

Senior Member

Joined: 18/10/2022
Location: Canada
Posts: 116
Posted: 03:02pm 25 Aug 2024
Copy link to clipboard 
Print this post

WOW!

Thanks guys so many things to check out almost don’t know where to begin.

This is what I love about this forum, there are so many guys with so many different interests when you ask a question you’re bound to run across multiple people that have multiple answers to give you direction.

Thanks so much guys. I gotta look at all of these posts and see what I want to pursue, I’ll definitely be back with some questions .

Thanks loads.

Hans …
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3800
Posted: 03:40pm 26 Aug 2024
Copy link to clipboard 
Print this post

  PhenixRising said  Claims of near-zero latency.

With motors it may be "near-zero" but it's a bus so a node wishing to send has to either abort current traffic or wait and unless it's the highest priority node may have to keep waiting.

Is it only non-techs who make claims like near-zero for comms latency?!

John
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 857
Posted: 03:55pm 26 Aug 2024
Copy link to clipboard 
Print this post

  JohnS said  
  PhenixRising said  Claims of near-zero latency.

With motors it may be "near-zero" but it's a bus so a node wishing to send has to either abort current traffic or wait and unless it's the highest priority node may have to keep waiting.

Is it only non-techs who make claims like near-zero for comms latency?!

John


True. I use a 4-wire RS485 but I don't rely on it for coordinating motion.
 
Hans

Senior Member

Joined: 18/10/2022
Location: Canada
Posts: 116
Posted: 10:30pm 26 Aug 2024
Copy link to clipboard 
Print this post

  disco4now said  
See this item on fruitoftheshed where I have started to document it.
Gerry


Thanks Gerry. I have a couple of those modules on order, should receive them tomorrow.

How do you identify the high and low line of the bus? Is it try one way and if no coms then the other?

Thanks a bunch,

Hans ...
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 857
Posted: 05:48am 27 Aug 2024
Copy link to clipboard 
Print this post

  Hans said  
How do you identify the high and low line of the bus? Is it try one way and if no coms then the other?

Thanks a bunch,

Hans ...


I believe that it's a standard RS485 signal. For each valid high, there's a mirror-image low. A noise spike would be uni-directional and would be rejected.
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024