I have purchased 2 SN65HVD230 CAN transceivers and connected them in the following way to the the Panda. I then wrote the following code and while it appears that the message is being queued, it is never recieved.
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.Hardware;
namespace CAN_Tests
{
public class Program
{
public static void Main()
{
const int BRP = 6;
const int T1 = 15;
const int T2 = 8;
// Initialize CAN Channel, set bit rate
CAN canChannel1 = new CAN ( CAN.Channel.Channel_1, ((T2-1) << 20)| ((T1-1) << 16) | ((BRP-1) << 0));
CAN canChannel2 = new CAN ( CAN.Channel.Channel_2, ((T2-1) << 20)| ((T1-1) << 16) | ((BRP-1) << 0));
CAN.Message message = new CAN.Message();
CAN.Message[] message2= new CAN.Message[1];
for( int i = 0; i < 8; i++)
{
message.data[i] = (byte)i;
}
message.ArbID = 0xDAE;
message.DLC = 8;
message.isEID = false;
message.isRTR = false;
//
CAN.Message[] send = {message};
int success = canChannel1.PostMessages( send);
Debug.Print(send.ToString());
while (canChannel2.GetRxQueueCount() == 0)
{
Debug.Print("Still nothing in the queue :-(");
}
canChannel2.GetMessages(message2);
}
}
}
To this point I have used CAN in our systems at work, but this is the first time I have attempted to set it up on a FEZ. Note: this is the first real problem I have run into using FEZ
Yep, after careful inspection I found that the 3v3 was intermittent. Duh. sorry.
BTW, when will the new CAN assembly be ready? No rush just want to know if I should wait to start implementing KW2000 or will I be able to migrate my implementation easily to the new assembly?
As a rule I have always placed a small cap as close to the as possible to each IC between power and ground to reduce the effect of the current draw caused by switching as much a possible. This is a carry over from 40 years ago when I did hardware design an my team lead insisted on it.
Just for fun I have include a photo of the IC on the breakout board where you can clearly see the cap. The breakout board is from SMD Adapters 8 pin SOIC Adapter, and the cap is a 0.1uf I scrounged form my bin.
i have been trying to weld my vp230 to SOIC adapter with no succes, i have aquired some MCP2551 which already are on DIP package. I ve reproduced the schematics you descrive with two MCP2551 and two FEZ Domino to send and receive CAN Message.
But i’m not able to receive any CAN on the reception board… I know that the MCP2551 is 5v logic but i think i ve read that’s fully supported by the fez domino right?
Should i do somme kind of pull up/down or add some divider ressitor between the Rx/Tx of the Domino and the Rx/Tx of the tranceiver?
I think the can sending is pretty close to be working because the CANchanel.IsTxBufferAvailable of the sending card become false after sending few messages(something like 4 CAnmessage).
On the reception card, the canChannel.GetRxQueueCount() deseperately stay =0
The chip will work just fine with our boards. Did you add a termination resistor on the wires? It should be 120ohm in total but you can use any close value…like 100ohm or whatever you have.
See this http://zone.ni.com/cms/images/devzone/tut/HS_CAN_Termination.gif
Sorry, for the missing datasheet i ll do it in the future.
Yes i have added a 60 ohms resistor between the CANH and CANL of my transceiver. The CANH and CANL of my two transceivers are directly linked to each other
i also aded a 0.1uf cap between 5V and ground as in Dave schematics