Welcome, Guest

Author Topic: CAN BUS  (Read 1316 times)

Sergiy

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
CAN BUS
« on: October 31, 2017, 02:50:54 PM »
Hello!

I'm going to buy A64-OLinuXino-2G16G-IND to link it with my car and I need to use CAN bus.
Is there some option to do this?
For A20 Lime I saw A20-CAN component. Can I use it for A64?

Thanks!
« Last Edit: October 31, 2017, 04:05:54 PM by Sergiy »

LubOlimex

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1713
  • Karma: +43/-2
Re: CAN BUS
« Reply #1 on: November 01, 2017, 11:19:05 AM »
Hard to say. We haven't done it. It will not work following only the already existing instructions for the A20 boards.

A20-CAN just connects MCP2551 CAN controller to three data pins of the board. Hardware-wise you can use it, taking into account that A64-OLinuXino has no GPIO-3 connector, probably using wires for the connections to the GPIO header.

Software-wise the effort might be quite bigger. Changing the pin definitions to correspond to the pins you've selected for the communication is the first step.

Best regards,
Lub/OLIMEX 
Technical support and documentation manager at Olimex

KeesZagers

  • Full Member
  • ***
  • Posts: 173
  • Karma: +2/-0
Re: CAN BUS
« Reply #2 on: November 01, 2017, 01:48:44 PM »
As far as I have seen the A64 controller does not have an internal CAN controller. The A20 has it. The CAN board for the A20 only has a CAN transceiver (MCP2551), no external CAN controller. So this will not do the job. You will need some kind of interface from SPI or I2C to CAN.

Sergiy

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: CAN BUS
« Reply #3 on: November 01, 2017, 09:20:40 PM »
Hello!
Thanks for answers guys! I'm c++ software developer familiar with Linux and right now coming to embedded developer, thanks for helping me.
I found some SPI to CAN converter: http://microcontrollershop.com/product_info.php?products_id=4719
Is this suits for A64? Can I plug it to A64 somehow? It can be enough to link with car can bus?

« Last Edit: November 02, 2017, 03:49:16 PM by Sergiy »

LubOlimex

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1713
  • Karma: +43/-2
Re: CAN BUS
« Reply #4 on: November 02, 2017, 04:47:10 PM »
As Kees mentioned it is not clear if the A64 chip has CAN controller inside, like the A20 chip had. Yet, I'm think that software implementation of a controller is possible and maybe somebody in linux made it. Kees might know more for CAN emulation.

The board that you linked has MCP2515 (which is a CAN controller) inside, so it is part of the solution. In this case you use MCP2515 as external CAN controller, and the connection between the A64 board and the controller board is over SPI. However, you still need A20-CAN or similar transceiver board between the CAN controller and the CAN network! You always need controller + transceiver board! Or a product that has controller + transceiver in one PCB.

That is why people often use MCP2515 + MCP2551 (now MCP2561). Check the Microchip forums for more information on that. I believe MCP2515 has good Linux support, same for MCP2551. This seems like a nice product (has extra chip for AT commands): http://docs.longan-labs.cc/can_bus/

Also why don't you just use an A20 board, the support is good. In addition to CAN controller it has SATA support. You can attach USB-WIFI dongle if the WIFI is the problem.
« Last Edit: November 02, 2017, 04:54:34 PM by LubOlimex »
Technical support and documentation manager at Olimex

Sergiy

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: CAN BUS
« Reply #5 on: November 02, 2017, 06:10:24 PM »
Thanks for the clarification!

A20+A20-CAN it's a good idea and I thought about it.

One thing stop me to use A20 - it is a temperature range. There is -25C for A64-IND against +0C for A20. I'm going to leave that hardware in my car =)

As far I understand if I decided to use SPI-to-CAN Converter from that online shop I will need to do following things:

(A64)->(SPI-to-CAN)->(A20-CAN)->(CARBUS)

Or

(A64)->(Serial CAN Bus)->(CARBUS)

Which is (Serial CAN Bus) - it is a component from site that you give me link


Is it the right way what I thinking about?



« Last Edit: November 02, 2017, 06:17:45 PM by Sergiy »

LubOlimex

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1713
  • Karma: +43/-2
Re: CAN BUS
« Reply #6 on: November 03, 2017, 09:27:10 AM »
Are you going to use Linux or Android? We have industrial A20 boards also. Even in stock. Check A20-OLinuXino-MICRO: https://www.olimex.com/Products/OLinuXino/A20/A20-OLinuXino-MICRO/open-source-hardware

More specifically:

A20-OLinuXino-MICRO-IND - industrial temperature grade (-45+85)C components

A20-OLinuXino-MICRO-e4GB-IND - industrial temperature grade components (-45+85)C and extra 4GB on-board eMMC flash memory

One thing to notice is that the A20 boards are mature and there is a lot more information and support. A lot of customer projects and experience are available. Furthermore, the A20-CAN comes with ready drivers and instructions and would be much easier to use directly with an A20 board.

Yes, what you described is correct. Basically you need a CAN controller and CAN transceiver. A20-CAN has only CAN transceiver. The SPI-to-CAN board that you linked has only CAN controller. The board that I linked has both (and it has extra main chip that allows usage of AT commands, which would further ease the software effort).

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

Sergiy

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: CAN BUS
« Reply #7 on: November 03, 2017, 11:30:08 AM »
Hi, thanks for A20-OLinuXino-MICRO advice, I didn't notice it =) . Right now I'm thinking it is a better idea.
I'm going to use Linux. Furthermore, I need GPS, Wifi, Bt, two cameras (rear and front) and touch screen.
Can I use following components with it:

https://www.olimex.com/Products/OLinuXino/LCD/LCD-OLinuXino-4.3TS/open-source-hardware
https://www.olimex.com/Products/IoT/MOD-WIFI-ESP8266/open-source-hardware
https://www.olimex.com/Products/USB-Modules/USB-BT4/
https://www.olimex.com/Products/Modules/GPS/MOD-GPS/

But I didn't find cameras in your site which can be suited for my needs =(
I would like to have something like this one: https://www.raspberrypi.org/products/pi-noir-camera-v2/

Can you help me to pick out those hardwares? I think you can advice me better solutions for it.
I appreciate you for helping me!
« Last Edit: November 03, 2017, 12:27:16 PM by Sergiy »

LubOlimex

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1713
  • Karma: +43/-2
Re: CAN BUS
« Reply #8 on: November 03, 2017, 01:20:34 PM »
I don't have much experience with the cameras, not sure about the software limitations also, but this one is tested: https://www.olimex.com/Products/Components/Camera/CAM-GT2005/ - we place it in A20-SOM-EVB. It is a low res camera but doesn't use USB port/power. Not sure about other cameras, maybe somebody here in the forum shared more. Not sure if it should be an USB camera or some other type of camera.

For WIFI I'd recommend this one: https://www.olimex.com/Products/USB-Modules/MOD-WIFI-AR9271-ANT/ and for BT any affordable dongle would work, for example this one: https://www.olimex.com/Products/USB-Modules/USB-BT4/

For display, depends on the size and the desire but our displays and touchcreens are easy to setup (there is a script in our official Debian images that can set the video output):

https://www.olimex.com/Products/OLinuXino/LCD/LCD-OLinuXino-7TS/open-source-hardware
https://www.olimex.com/Products/OLinuXino/LCD/LCD-OLinuXino-10TS/open-source-hardware

You need this cable to connect the display to the board: https://www.olimex.com/Products/Components/Cables/CABLE-IDC40-15cm/

If you need something better consider HDMI display with USB touchscreen, since these are generally easier to setup.

For initial research and development you would need a 12V power supply for the board. For such a heavy setup, I recommend you to search for a supply capable of providing at least 2A at 12V. We don't have such powerful power adapters.

During initial research and development it is highly recommended (very close to mandatory) to have a debug cable for direct access to the command line interface of the board, I recommend you this one: https://www.olimex.com/Products/Breadboarding/BB-CH340T/open-source-hardware but it comes without wires so consider some wires with female-female connectors.

Best regards,
Lub/OLIMEX

Technical support and documentation manager at Olimex

KeesZagers

  • Full Member
  • ***
  • Posts: 173
  • Karma: +2/-0
Re: CAN BUS
« Reply #9 on: November 04, 2017, 08:01:30 PM »
Did not look on the forum for some days and as far as I have seen the CANbus issue will be solved by using the A20.
However still two remarks from my side to the earlier answer of Lub.
1. The SPI-CAN board you had found does include both the MCP2515 CANcontroller and the MCP2551 CAN transceiver, so it was a complete hardware solution.
2. If a CPU has no CAN hardware included it is impossible to emulate such an interface in software. You should execute instructions within nanoseconds. If you want to build your own CAN controller you should do that in an FPGA. Furthermore the CAN protocol is a registered protocol of Bosch. If you want to make your own controller you have to pay the license costs to them. If it is included in a CPU or in a stand-alone controller the supplier has paid the license costs.

Sergiy

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: CAN BUS
« Reply #10 on: November 06, 2017, 02:45:38 PM »
Hello, Kees!

As far I understand Allwinner A20 itself has the CAN hardware support and question is the A64 has or not.
And if A64 has support I can use

(A64)->(SPI-to-CAN)->(CARBUS) without A20-CAN controller.
I didn't find GPIO expansion specification. Where are SPI and I2C ports ?


Right now I'm googling what can I do with A20-OLinuXino-MICRO.
According https://en.wikipedia.org/wiki/Allwinner_Technology page I have:
In one hand A20-OLinuXino-MICRO has more information and support as mention LubOlimex but in other hand we have old proccessor :(

I want to store the video as good quality as possible. A64(Cortex A53) has encode possibility [ H.264 1080p @ 60 fps ]  but A20(Cortex-A7) [ H.264 1080p @ 30 fps ]
A64 has 4 cores against 2 cores in A20.
Farthermore,  A64-OLinuXino has on-board Bt, Wifi =)

Before buy something I constantly change my mind

Thanks for helping me!




« Last Edit: November 06, 2017, 05:47:28 PM by Sergiy »

Sergiy

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: CAN BUS
« Reply #11 on: November 06, 2017, 06:29:47 PM »
I have a question about cameras.
As far I understand A20/A64-OLinuXino uses common Linux distro but a little a bit older than now.
And I can use usual USB cameras. Just I have to find drivers for that Linux distro?

It is possible to connect and work with TFT 5” http://www.newhavendisplay.com/tfts-50-tfts-c-1_595.html   ?
« Last Edit: November 07, 2017, 12:31:13 AM by Sergiy »

LubOlimex

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1713
  • Karma: +43/-2
Re: CAN BUS
« Reply #12 on: November 07, 2017, 10:15:52 AM »
<<< As far I understand A20/A64-OLinuXino uses common Linux distro but a little a bit older than now.

For video and audio you are pretty much stuck with sunxi kernel. For server purposes mainline is a viable option.

<<< And I can use usual USB cameras. Just I have to find drivers for that Linux distro?

Yes. It might be a good idea to check what cameras others managed to get working with the same chip previously.

<<< It is possible to connect and work with TFT 5” http://www.newhavendisplay.com/tfts-50-tfts-c-1_595.html   ?

Anything is possible. Getting this display might be very hard however, including creating a custom board between the board and the display. Make sure to check this post: https://www.olimex.com/forum/index.php?topic=2892.0 and this blog entry: https://axonjakarta.wordpress.com/2014/03/24/7-capacitive-touch-for-a20/

That is why I recommend you to either get a TFT module (display + control/interface board) for RGB interface or even better TFT module for HDMI display (for a reference it looks something like this: https://www.seeedstudio.com/5-inch-800x480-Capacitive-TouchScreen-p-2923.html). This saves the hardware effort, only software effort remains (few edits of the script file).

We are also have 5 inch display with capacitive touch done, not sure when it would be available for purchase. I'd upload the schematics at later point today at our github pages.
Technical support and documentation manager at Olimex

Sergiy

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: CAN BUS
« Reply #13 on: November 07, 2017, 11:32:18 AM »
Thanks, LubOlimex!

Unfortunately display like this one ( https://www.seeedstudio.com/5-inch-800x480-Capacitive-TouchScreen-p-2923.html )
does't suits for me due to limited space. Side connectors eat all my free space.

I have the place for display 140X100mm . LCD4.3" - It's small and LCD 7" it's big.
Those TFT 5" displays (120.7mm x 75.8mm) are very close to my needs =)

Looking forward to see your upload.



« Last Edit: November 07, 2017, 01:00:03 PM by Sergiy »

Sergiy

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: CAN BUS
« Reply #14 on: November 07, 2017, 01:59:30 PM »
I thought, I would be able done something like this but for A20-MICRO :
https://www.newhavendisplay.com/NHD_forum/index.php?topic=908.0

For instance if I know display specification and A20-MICRO expansions I can plug display into board according by those papers and done some programming part like this:
http://www.newhavendisplay.com/app_notes/NHD-C160100DiZ.txt

And I will be happy =)

In which way I can recognize I would done it or not?

Thanks!