-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not working for TxHeader.DataLength > FDCAN_DLC_BYTES_2 #1
Comments
What error are you seeing? Is it printing 'CAN: sending message failed"? I've looked at the code. I can see a bit of a weird bit on the receiving end but the sending bit looks ok. The bit that looks weird is:
I can't see where rxData is initialized. The code was originally written by erwin74 and discussed here: |
It's seems to be actually sending the message: addMessageToTxFifoQ returns HAL_OK -> "CAN: sending message was ok.". I guess the problem is on the receiving side. _rxData is initialized here (SimpleCan.cpp), but I'm not so sure about rxData. SimpleCan::RxHandler::RxHandler(uint16_t dataLength, void (*callback)(FDCAN_RxHeaderTypeDef, uint8_t *))
{
_rxData = new byte[dataLength];
_callback = callback;
}
Tomorrow I'll compare this with another example and see if I can come up with the solution. |
Can you remove most of the code from handleCanMessage and see if the function is triggered e.g.
|
Will try that tomorrow, thanks. EDIT: It is receiving. Must be blocking somewhere on the handleCanMessage function. EDIT2: It works if I print it out of the for loop. Serial.print is blocking for some reason? Serial2.println(rxData[0]);
Serial2.print(" ");
Serial2.println(rxData[1]);
Serial2.print(" ");
Serial2.println(rxData[2]);
Serial2.println(); EDIT3: This bit of code inside the for loop blocks everything for some reason: Serial2.print(" byte[");
Serial2.print(byte_index);
Serial2.print("]="); When I commented it out it stopped blocking. |
Hi. I managed to make your example work on two NUCLEO-G431KB. Thank you for that.
Now, my problem is that I can't make it work with more than 2 bytes, even after setting TxHeader.DataLength = FDCAN_DLC_BYTES_3, etc..
Sketch:
Additional info:
Thank you.
The text was updated successfully, but these errors were encountered: