Show Posts
Pages: [1] 2
1  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: April 13, 2013, 11:44:22 am
Yeah, using VB .NET with the NI measurement studio to make the gauges/graphing a bit easier. The ethernet shield is only in there for the SD card slot atm until I get hold of one of the newer wireless shields.
2  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: April 12, 2013, 08:33:28 pm
A few pictures from today's testing. Seems to be going well so far...



Just need to get a suitable power supply for the arduino plumbed into the car and decide what other features I want to get in.
3  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: April 07, 2013, 07:00:13 am
Do you have a project thread or some place you post about what your working on

Nope - it's just a simple read CAN, write serial, let computer software make it pretty. Pretty much all the code for the first two parts can be found in the CAN examples palliser and adderd put out with their libs. The only thing left for you to do is put the CAN data into a format you'll be able to extract it at the other end of the serial interface.
4  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: April 06, 2013, 01:09:49 pm
jspobuk: I don't want to sound like I'm stating the obvious, but since you say you're new to it then it may have been overlooked.... make sure the serial bitrate in your serial console is the same as the one in the serial.begin line. Without the code to hand I can't be certain, but I don't think there's any "halts" in the code before the first bit of code you post, and mismatched speeds could be a prime culprit there.
5  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: April 03, 2013, 05:06:17 pm
Just a quick note to say I got my setup hooked up to the car today and it was working a treat. I've even got a nice interface in .NET at the other end to display the data. I'll try and get some pictures taken on Friday when I work on it again to share. smiley

Thanks for the hard work put in so far, and I look forward to seeing where this library goes in future!
6  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: March 28, 2013, 06:54:13 am
Only example 4 in AdderD's code uses extended (29-bit) identifiers. All the other examples use the old standard identifiers. Make sure you're checking against the right variable? The family ID isn't the frame standard/extended id...

The difference is when setting up the mailbox, there's a "true" or "false" at the end of the parameter list - true is extended, false is standard.
7  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: March 25, 2013, 05:29:53 pm
Thanks Palliser. I had a feeling that would be the case, but thought it was worth checking if there was a standard before I call them and look silly. smiley-wink

It's a less-than-common ECU - a DTA fast S series. I'll get on to them tomorrow and try to get a copy of the matrix. All they give us on their site is a basic list identifying which byte(s) of each frame relate to which sensors.
8  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: March 25, 2013, 03:05:19 pm
Thanks for your earlier support AdderD, and the continued development. I've got the Due happily taking data off a 1MHz bus with a DTA ECU and accelerometer spamming it.

Code:
CAN message received:
13036 0x2000 0x1EFF Ext 8b 0 0 5C 0 14 0 12 0 
13042 0x498 0x1EFF Std 8b 7F CD 7F 4F 88 34 80 7 
13049 0x2001 0x1EFF Ext 8b 64 0 3 2 0 0 11 0 
13055 0x2002 0x1EFF Ext 8b 2C 1 3C 0 79 0 0 0 
13061 0x2003 0x1EFF Ext 8b 0 0 0 0 0 0 0 0 
13067 0x2004 0x1EFF Ext 8b CD E 0 0 0 0 0 0 
13073 0x2005 0x1EFF Ext 8b 0 0 0 0 1F 1 42 3 

Working a treat. I don't suppose anyone knows if there's some industry standard for converting data put out by the ECU to something useable? I know our ECU has 6 data frames (0x2000-0x2005), each 8-byte with 2 bytes for each value (engine rpm, throttle position etc) but not sure if there's a standard way to turn this into something useable (0x5C00 doesn't mean much as an idle throttle position!) or if I'm going to have to ask the ECU manufacturer nicely to give us some help converting.
9  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: March 24, 2013, 09:32:41 am
Great, thanks for the clarification. I was concerned that if I'm doing other things before checking for the message then I might miss some off the bus. smiley
10  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: March 22, 2013, 09:28:44 pm
Just want to say thanks for the work you're putting in AdderD. Dropped the delay to 10 microseconds and made it report to serial every 50,000 instead and it's whirring along at over 30 million packets after a few minutes.

Started putting together my own code using the samples as a base, and I've come across something that has me stumped although that could be as much to do with the time as anything else.

The second sample says it uses interrupts rather than polling, but as far as I see in the code it runs the 'test1()' function after enabling the interrupt. The test1() function sends data from CAN2 then hits a while loop waiting for CAN to have received data - isn't this still polling rather than using interrupts? I was hoping to be able to do something else whilst waiting for data to be received...
11  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: February 15, 2013, 06:50:09 pm
Thanks for the time and effort from all those who have worked on it so far. It'll be great to have something to get our teeth in to. smiley
12  Products / Arduino Due / Re: Building a CAN communication protocol interface for Arduino DUE on: February 15, 2013, 08:02:52 am
Another week passes and still nothing in GIT. Hardly the spirit of open source, is it?
13  Using Arduino / Programming Questions / Re: Mega + MCP2515 : Interrupt Issues on: February 05, 2013, 03:09:39 pm
Re-enabling the interrupts was a last ditch effort because I can be certain another interrupt won't come along (until the CAN.setRegister changes the flag in the MCP2515) and the SPI stuff didn't seem to happen without it. I'll drop the logging (since that part was more for debugging so I could see if the interrupt was firing) tomorrow and see if it's any more responsive, thanks.
14  Using Arduino / Programming Questions / Re: Mega + MCP2515 : Interrupt Issues on: February 05, 2013, 10:37:59 am
I've stripped the interrupt code down as far as I can and I've come up with:

Code:
  interrupts();
    unsigned int retID;
    int i;
    unsigned short id_h,id_l,extid_8,extid_0;
    digitalWrite(SS,LOW);
    SPI.transfer(READ_RX_BUF_0_ID);
    id_h = (unsigned short) SPI.transfer(0xFF); //id high
    id_l = (unsigned short) SPI.transfer(0xFF); //id low
    extid_8 = (unsigned short) SPI.transfer(0xFF); //extended id high
    extid_0 = (unsigned short) SPI.transfer(0xFF); //extended id low
    retID = ((((((((id_h << 3) + ((id_l & 0xE0) >> 5))<<2)+(id_l&0x03))<<8)+extid_8)<<8)+extid_0); //repack identifier
    i=retID-0x2000;
    ECU[i].id++;
    ECU[i].length = (SPI.transfer(0xFF) & 0x0F);
    ECU[i].time = millis();
    ECU[i].address = retID;
    ECU[i].data1 = SPI.transfer(0xFF);
    ECU[i].data2 = SPI.transfer(0xFF);
    ECU[i].data3 = SPI.transfer(0xFF);
    ECU[i].data4 = SPI.transfer(0xFF);
    ECU[i].data5 = SPI.transfer(0xFF);
    ECU[i].data6 = SPI.transfer(0xFF);
    ECU[i].data7 = SPI.transfer(0xFF);
    ECU[i].data8 = SPI.transfer(0xFF);
    digitalWrite(SS,HIGH);

    logLine("Received interrupt on RX0 address: 0x",0);
    logLine(retID);
     
    CAN.regBitClr(CANINTF,0x01); // Clear interrupt flag in MCP2515


Still, there's no time between interrupts to do any other processing. 'logLine' is just a function that sends the output to serial and an SD card. Is it something within my code that's not running fast enough or is the SPI just too latent to use within an interrupt in this way? ATM I've got it down to just reading one data packet out of the CAN stream that's sent at 10Hz, but even this isn't leaving any time to process the data on the fly.

I'm currently toying with the idea of picking up a Due to test the code on and see if the faster clock speeds can handle it, but I don't want to throw away money if there's something wrong in the code itself.
15  Using Arduino / Programming Questions / Re: Mega + MCP2515 : Interrupt Issues on: February 04, 2013, 05:59:22 pm
One of the things I'm doing within the interrupt is reading from the MCP2515 over SPI. Does anyone know if reading from SPI uses interrupts in any way? Since nothing else should be firing interrupts at the time (MCP2515 stops until the ISR finishes and clears the interrupt flag) it should be reasonably safe to enable them at the start of the ISR, but I won't get a chance to test it until tomorrow afternoon. Would be nice to know if anyone else has had similar experiences.
Pages: [1] 2