Polling CAN data

A forum for discussing the MegaSquirt related (but non-B&G) board development, assembly, installation, and testing.

Moderators: jsmcortina, muythaibxr

Post Reply
MolsonB
Helpful MS/Extra'er
Posts: 76
Joined: Sun Aug 16, 2015 8:47 pm

Polling CAN data

Post by MolsonB »

Hi guys, I have my own CAN setup on a Teensy board, and I can receive all the broadcasting fine (1520 base). But I can't seem to get any polling request from MS3, or if I send a Msg_Req, I don't get a Msg_Rsp back.

For example, trying to set the RTC.
I set Enable Real Time Clock to CAN, and for compatibility reasons I picked the same as JBPerf. Table is 7 and offset is 110.
The only CAN messages I receive, are just the broadcasting ones and not any MSG_REQ to send the new time.
Is there a setting I'm missing? I even enabled ADC polling and turned on a few, but no requests show up.

Reading the Can Protocol PDF, I tried to fetch the RPM, and didn't receive anything back. Not sure what I'm doing wrong.

MS3 pre-1.5.1 beta 7

*Looking into things more, do I have to get complicated and create my own Can Device under Project Properties with an .ini file?
grom_e30
Super MS/Extra'er
Posts: 4451
Joined: Thu Mar 08, 2012 12:44 pm
Location: UK

Re: Polling CAN data

Post by grom_e30 »

no need to add a can device with an ini. is your teensy masking 29bit headers? maybe post the teensy code and a msq file for the ecu.
1990 bmw 320i daily driver with m20b25 ms3 sequential fuel, 380cc injectors, d585 coil near plug, home made cam sync, launch control, fan control, vss, homebrew egt logging what's next????
Manu
Master MS/Extra'er
Posts: 723
Joined: Mon Feb 15, 2010 4:57 am
Location: Alès - France
Contact:

Re: Polling CAN data

Post by Manu »

Hello,
With the recent flexcan librairie, you have to set mailboxes to use extended CAN. There are posts about this at pjrc forum.
Regards,
Manu
I can supply, repair or upgrade Megasquirts in FRANCE.

Image
https://www.megasquirt.fr
MolsonB
Helpful MS/Extra'er
Posts: 76
Joined: Sun Aug 16, 2015 8:47 pm

Re: Polling CAN data

Post by MolsonB »

Thank you both, it looks like it was the 29bit / extended problem. I'm not using classes and sticking to the polling.

I had to add the filters in my 'Setup'.

Code: Select all

  
static CAN_message_t txmsg, rxmsg;

void setup(void) {

Can0.begin(500000); 

CAN_filter_t allPassFilter;
  allPassFilter.id=0;
  allPassFilter.ext=1;
  allPassFilter.rtr=0;

  //leave the first 4 mailboxes to use the default filter. Just change the higher ones
  for (uint8_t filterNum = 4; filterNum < 16;filterNum++){
    Can0.setFilter(allPassFilter,filterNum); 
  }
}


void loop(void) {
  if (Can0.read(rxmsg))  ..........
}

Post Reply