issue with Flexcan & FreqMeasureMulti

Status
Not open for further replies.

stephtech

Member
Hi,
First post here, hopefully it would be a simple answer.

I am using a teensy 3.2 for a digital dashboard in a car. I am using the Flexcan library to interface CANbus with the car.
I am also using freqmeasuremulti library to read a PWM signal from an ethanol sensor.

If I run a sketch with only freqmeasuremulti and output the result on the serial console, the frequency measured is working properly.
If I run a sketch with only Flexcan, I can read/write CAN message and operation is perfectly normal.

When I have a sketch with both libraries (and associated code) running together, the freqmeasuremulti is outputing garbage measurements. CANbus seems to continue to be operating normally.

I have stripped down the code to have the minimum code excecuting, I am also doing next to nothing in the interupt to avoid stalling the rest.
I suspect the both might be using the same timer. Do I am on the right track as a potential issue?

I am not posting code yet because it might be something obvious that I missed.

thanks for any clue
 
What happens with both libs loaded - maybe init the Flexcan - then with no Flexcan message activity - does freqMM run okay?

Flexcan uses an _isr() - either the timing is messed up from that - or it is some conflict with a shared resource?
 
What happens with both libs loaded - maybe init the Flexcan - then with no Flexcan message activity - does freqMM run okay?

Flexcan uses an _isr() - either the timing is messed up from that - or it is some conflict with a shared resource?

just did the test with no CANBUS messages (bus disconnected) the freqMM is measuring ok. So that must not be an initialization issue.
 
If you could safely start up and send receive a few messages then disconnect and then see the freqMM working - that would point to the _isr() for can msgs just messing with the timing.

There could be other issues - but hopefully this at least shows it can work.
 
I notice that flexcan.cpp starts with this section...

Code:
#include "FlexCAN.h"
#include "kinetis_flexcan.h"

static const int txb = 8; // with default settings, all buffers before this are consumed by the FIFO
static const int txBuffers = 8;
static const int rxb = 0;

Further down it seems that these spaces are used for send/receive buffers.

I suspect Flexcan and FreqMeasure are attempting to use the same FIFO, especially as they play nice so long as the bus is disconnected.

Other than that, I can't be much help! Sorry!!
 
If you could safely start up and send receive a few messages then disconnect and then see the freqMM working - that would point to the _isr() for can msgs just messing with the timing.

There could be other issues - but hopefully this at least shows it can work.

I send/receive CANBUS message ok, FreqMM report bad measurements, I disconnect the CANBUS and frequency measured are back to normal.
 
I notice that flexcan.cpp starts with this section...

Code:
#include "FlexCAN.h"
#include "kinetis_flexcan.h"

static const int txb = 8; // with default settings, all buffers before this are consumed by the FIFO
static const int txBuffers = 8;
static const int rxb = 0;

Further down it seems that these spaces are used for send/receive buffers.

I suspect Flexcan and FreqMeasure are attempting to use the same FIFO, especially as they play nice so long as the bus is disconnected.

Other than that, I can't be much help! Sorry!!

hi Mike,
thanks for having a look. I will check it out just to be sure but there should be ample memory left for other buffers.
 
I send/receive CANBUS message ok, FreqMM report bad measurements, I disconnect the CANBUS and frequency measured are back to normal.

Which pins are you using? (we can't see your code or how you've connected the hardware)

Maybe this could be related to FTM2 vs CAN pin config...
 
Which pins are you using? (we can't see your code or how you've connected the hardware)

Maybe this could be related to FTM2 vs CAN pin config...

This is a teensy 3.2 with a single CAN, so I am connected on pins 3 & 4. As for the FreqMM, I am connected on pin 6.

thank you Paul for your input. If related to FTM2, would there be an alternative connection that would work?
 
Status
Not open for further replies.
Back
Top