CAN bus and SD card over the same SPI channel

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
kennethnilsen69
Posts: 101
Joined: Tue Sep 01, 2015 9:37 pm
Been thanked: 14 times
Contact:

CAN bus and SD card over the same SPI channel

Post by kennethnilsen69 »

Hi, I want a CAN bus card and an SD card reader on the same SPI bus. is this possible?
I want to save about 32000 CAN messages in a file on an SD card and send them over the CAN bus. so it must be able to read the SD card and send the message one by one at the same time.
So I will:
read a message from a file on the CD card, send the message on the CAN bus, read a message from a file on the CD card, send the message to the CAN bus, this will be done about 32000 times

Is this possible or will this make a lot of disturbance on the SPI bus.
The connection I think I understand. I just have to have CS on 2 different pins. is that correct?

Thanks :-)

kennethnilsen69
Posts: 101
Joined: Tue Sep 01, 2015 9:37 pm
Been thanked: 14 times
Contact:

Re: CAN bus and SD card over the same SPI channel

Post by kennethnilsen69 »

Is there nobody who knows anything about this?

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: CAN bus and SD card over the same SPI channel

Post by LeighM »

It is easier to answer more specific questions. There are a few unknowns in your question, such as what hardware you are using, and Flowcode?
In principal what you want to do should be possible, with two chip selects as you suggest.
There are possibly some issues to think about, such as do the two devices operate with the same SPI mode? Do the CAN messages need to be sent at any particular rate? i.e. time taken between messages to read from SD card etc.

kennethnilsen69
Posts: 101
Joined: Tue Sep 01, 2015 9:37 pm
Been thanked: 14 times
Contact:

Re: CAN bus and SD card over the same SPI channel

Post by kennethnilsen69 »

The hardware I use is:
Arduino Mega 2560 R3
Can Module is MCP2515 and TJA1050, 20mhz and baud 500

Flowcode 7

I have never used an SD card reader before so this will be new to me, but I have ordered 20 pcs of this one
https://www.ebay.com/itm/5-x-Micro-SD-S ... 2749.l2649

SPI mode I do not know anything about it. There are no options for this on properties

Post Reply