Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Issues with format of the data in CMessage class #10

Open
Marcel307 opened this issue Nov 16, 2023 · 4 comments
Open

Issues with format of the data in CMessage class #10

Marcel307 opened this issue Nov 16, 2023 · 4 comments

Comments

@Marcel307
Copy link

Hi,
I am a bit new to this library and CAN in general. I have an ADXL357 accelerometer that give me 3 axis, each containing 8 Bytes of data, becausse the values are on type double. Now just for a small test I want to sent out each iteration one axis, in my case z. But it seems like the append() is setting the ok variable to false, not sending out any kind of data. On startup there is weird behaviour, because it tells me that the ok Variable is true, but the number of SentFrameCounts is not progressing more than just to the value of one.

So I am asking myself what the problem might be?

Snipplet out of the main File. This whole snipplet is written within a for-loop function iterating through the different sensors.

CANMessage frame;
            if(gSentFrameCountESP32 < MESSAGE_COUNT)
            {
            frame.id = 0x001F;                                             
            frame.len = 8;                                                   
            frame.data_s64 = z;                                            
            frame.rtr = false; 
            frame.ext = false;                  
            const bool ok = ACAN_ESP32::can.tryToSend(frame);              
            Serial.print("The Value of the ok variable is: ");
            Serial.println(ok);
            if(ok)
                {
                    gSentFrameCountESP32 =+ 1;                              
                }
            }   

            while(ACAN_ESP32::can.receive(frame))                        
            {       
                gReceivedFrameCountESP32 =+ 1;                            
            }
            Serial.print("Numbers of packets sent: "); 
            Serial.print(gSentFrameCountESP32);
        }
@pierremolinaro
Copy link
Owner

pierremolinaro commented Nov 16, 2023 via email

@Marcel307
Copy link
Author

Marcel307 commented Nov 17, 2023

No the CAN Controller the Module is not alone in the Node. I am also using a another ESP32 and a another Module that supports CAN. Important to note is that the other ESP32 is using a another CAN lib. Before I testet this setup and it worked so that is confusing. And yes it is setup in normal mode.
But I don`t know what exactly you mean with the configurement of the CAN module?

static const uint32_t DESIRED_BIT_RATE = 1000UL * 1000UL ; // 1 Mb
static uint32_t gBlinkLedDate = 0;
static uint32_t gReceivedFrameCountESP32 = 0 ;
static uint32_t gSentFrameCountESP32 = 0 ;
static const uint32_t MESSAGE_COUNT = 10 * 1000 ;

void setup()
{
settings.mRequestedCANMode = ACAN_ESP32_Settings::NormalMode ;  
settings.mRxPin = GPIO_NUM_33;                                 
settings.mTxPin = GPIO_NUM_32;                                  
const uint32_t errorCode = ACAN_ESP32::can.begin (settings) ;
.
.
.
}

Marcel

@Marcel307
Copy link
Author

Hello there,
I have resolved my issues mentioned before. But now I have a other question. I want to send out the accel data of type double. If I want to send out the double data or add the type to the CANMessage class the frame will not be sent. Why is that?

Marcel

@pierremolinaro
Copy link
Owner

pierremolinaro commented Nov 27, 2023 via email

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants