Go Down

Topic: Building a CAN API for Arduino DUE (Read 379047 times) previous topic - next topic

tbit

http://togglebit.net/how-to-gateway-messages/
Dan - www.togglebit.net - Arduino DUE proto shields - Arduino DUE CAN shields

gaskraank

Hey Thank you for the fast answer.

My researches brought me to your can Shield and Im gonna buy it.

But my actual question was about, is the Clock Speed sufficient to forward 200 Messages and not only like 7.
I just want to Manipulate one of these messages.

Thank you so much for your support.

Greetings

tbit

Clock speed is only a part of a more complex problem. I suggest having a read through the datasheet for the processor and inspect the underlying code you'll see there are message filters and different and more efficient ways of handling ISR's with hardware pointers, and then you have the overhead of your code, message buffer sizes, baud rate, the transmit rate of messages that are transmitted from your devices etc.

Maybe a valid first step is to simply just test the code thats written and see how far you get and optimize from there....i've not tested that particular bit of code with 200 messages.
Dan - www.togglebit.net - Arduino DUE proto shields - Arduino DUE CAN shields

gaskraank

Okey thank you so far.

I don't have a due here to try it so I have to order both.

Im just stucking if I should just go ahead with a Raspberry PI 3 where the performance would be much higher.
I don't want to waste my really small budget.

Greetings.

tbit

I don't know that a PI3  has a built-in CAN controller, so you will be stuck with what you can get through SPI just something to look out for....
Dan - www.togglebit.net - Arduino DUE proto shields - Arduino DUE CAN shields

AdderD

Okey thank you so far.

I don't have a due here to try it so I have to order both.

Im just stucking if I should just go ahead with a Raspberry PI 3 where the performance would be much higher.
I don't want to waste my really small budget.

Greetings.
For what it's worth, I've used my library (due_can) to capture over 4000 frames per second with the Due. I can send that quickly too. I really don't think you're liable to have any trouble in forwarding 300 messages per second. I can see no reason this wouldn't work with ToggleBit's library too. The Due is plenty fast for keeping up with two CAN buses.

yoh-there

^What AdderD said^. Don't worry. It's lightning fast. I am receiving 1000 fps on the Due. And even doing some silly slow sprintfs on the data.

tbit

Dan - www.togglebit.net - Arduino DUE proto shields - Arduino DUE CAN shields

gaskraank

Hey Guys,

thank you so much for the reputation!

As soon as everything arrives I will report if it works or not.
The source code to implement this should be really easy.

If have the time and opportunity I will do some measurements how fast a message gets forwarded.

Thank you all!

Greetings

gaskraank

#609
May 01, 2018, 02:33 pm Last Edit: May 01, 2018, 03:42 pm by gaskraank Reason: Forgot attachments
Hey Guys,

my Arduino just arrived.

I wired the attached circuit together and tried to receive some messages.
Everything worked well, but when I try to use the PingPong, Echo Example nothing happens.
This means the sendFrame function is not working.

Is there anything special to be aware of?
The circuit how I done is in the attachment.
I tried to use this circuit :


I'm currently using the SN65HVD230 from Texas Instruments.

Greetings.


ard_newbie

#610
May 01, 2018, 04:18 pm Last Edit: May 01, 2018, 04:45 pm by ard_newbie
You need 120 Ohms resistors at each end of the bus.

If you have issues with your transceivers, to test your CAN software, make a CAN bus without transceivers (it works up to a few meters long):

https://www.mikrocontroller.net/attachment/28831/siemens_AP2921.pdf

Note that you would have to connect the resistor to 3.3V (and not 5V). Choose the resistor so that the current be lower than 1.6 mA.

gaskraank

#611
May 01, 2018, 06:55 pm Last Edit: May 01, 2018, 06:58 pm by gaskraank
Hey Thank you for your answer.
Okey I added the 120 Ohm and I also have a lot of traffic on the can RX side already.

If I want to send a frame this won't work.
Do you think that's because of the transceiver.
Greetings

ard_newbie

#612
May 01, 2018, 07:34 pm Last Edit: May 01, 2018, 07:53 pm by ard_newbie

Do you think that's because of the transceiver ?.

The most obvous answer is NO, but there must be something wrong in your wiring.

Check all contacts on your breadboard.

The bus is supposed to be a twisted pair, althought it should not be an issue on such a short distance.

gaskraank

Hey,

I just breaked out CANTX on the Oscilloscope  and I have a Square Signal on that. If Break-Out CANH or CANH there's only noise.

Do I have to activate Receive and Send on the transceiver could that be possible?

Greetings.

AdderD

That particular transceiver has no enable pin so it is essentially always on. If you have signals on CANRX and CANTX but the CANL and CANH lines are garbage then there is likely a wiring fault on the H/L side (the actual CAN bus). What you should get is a square wave on H/L when you use L for ground on your scope and H at the scope input. Or connect to your local board ground with the scope and L will sink then return to center and H will rise and return to center. They ought to rest at essentially the exact same voltage. At rest H = L so you will measure 0 volts. When active they pull away from each other as a squarewave that ought to look like an exact mirror image of each other. The more it differs from that ideal the worse off you are.

Go Up