-
Notifications
You must be signed in to change notification settings - Fork 12
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
CAN-transmission errors #17
Comments
Maybe the following information about it. Now I have the entire system running with your ESP32-ACAN. So I use the internal CAN controller of the ESP, the hardware from the CAN driver (MCP2558) on the board and the desk is the same. The system runs perfectly in all variants, even with a bus load of 100%, no errors occur. setup acanESP32: setup acan2517: ACAN2517Settings settings (ACAN2517Settings::OSC_20MHz,canbaudini) ; // 20 MHz-Quarz I made the attempt and expanded the TX transmit buffer size ... but also used the TXQ buffer, it has brought me to ekinem success so far. |
This behavior is surprising, can you send me your sketch for testing?
Pierre
… Le 8 janv. 2022 à 02:21, tomtom0707 ***@***.***> a écrit :
Hello Pierre, but once again about my problem with the transmission errors, because it may not be (only) because of the SPI transmission rate. For this purpose I examined my "good" circuit, which did not generate any errors, i.e. the one with the 20MHz crystal on the MCP and the SPI transmission with 10MHz generated with it. The peculiarity here is that one message is specifically sent in a time interval
Experimental setup 1:
ESP32 and MCP2518 with 20MHz crystal, SPI, no interrupt pin, no data is received in the ESP32, it is only sent.
I am sending a message with 6 bytes of data at a frequency of 4 KHz. The CAN runs at 1MBaud, resulting in a bus load of approx. 41%. No other participant on the bus sends further data. Everything works fine, over 10 million messages sent, no errors.
Experiment setup 2:
Exactly the same as 1, the following change: the CAN now runs with 500kBaud. This leads to a bus load of approx. 82%. Now errors occur, remote frames are received and also messages that were never sent. (approx. 1 error per 10000 transmissions) The stress with the higher bus load is only caused by the MCP, the SPI transmission does not change. He only sends alone, so he doesn't have to fight for priorities. I can't explain why ...
Experiment setup 3:
Exactly the same as 1, the following change: 4 different messages are sent in the program from the ESP to the MCP in direct succession. The transmission frequency for these 4 messages is 1KHz, so the CAN bus load is again at 40%. Now errors arise:
Specifically sent: CAN-ID(hex): 320, 321, 322, 323 - 45000 each,
received: 320 and 321 each 45000, 322: 44992, 323: 44110, additionally the following messages and number on ID(hex): 302: 8; 303: 890 It is noticeable here that the last 2 messages are badly affected.
I have solved the problem by waiting 70µs after each sending of a message before I send the next one. Then it runs without errors. I can't really explain that to myself, because I'm writing in the buffer, but that's how it is.
But that is just a deceptive "good condition". Because if a second device sends data on the bus and the bus load increases again, to around 60%, then these errors occur again.
Do you have any idea? So when the MCP gets stressed, errors occur on the bus. Which settings can you adjust?
Thanks.
—
Reply to this email directly, view it on GitHub <#17>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AEWKZVCEI7AJ5P63SA2CMJ3UU6GQNANCNFSM5LQAAAUQ>.
Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you are subscribed to this thread.
|
Too bad nobody cares... :( |
Hello,
Thank you for you detailed report.
What is your micro-controller ?
I have just ran my TestWithACAN2515 and LoopBackIntensiveTestTeensy3x sketches, they run without any error.
You can try the ACAN2517Settings::OSC_4MHz10xPLL setting, but I don't think it makes any difference.
A detail : micros() returns an uint32_t, so gBlinkDate should have this type.
An other detail: un standard data frame with 8 bytes takes between 111 and 135 bits, 111 µs / 135 µs at 1 Mbit/s. So sending a frame every 100 µs is not possible, therefore you should observe "Send Failure" message. Do you see this message ?
Note the code
if ((micros() - gBlinkLedDate) > 100) {
gBlinkLedDate = micros() ;
does not ensure a periodic execution (the '>' provides a period greater or equal to 101). It is better to write:
if ((micros() - gBlinkLedDate) >= 100) {
gBlinkLedDate += 100 ;
You have also to set the initial value of gBlinkLedDate to a given value (for example gBlinkLedDate = 1000000 for starting 1 s after boot), otherwise you will have a burst at start up.
All the frames that are given by your CAN logger are valid frames, or it prints also invalid ones ?
Kind regards,
Pierre
… Le 3 avr. 2022 à 19:27, tomtom0707 ***@***.***> a écrit :
Hello, I took the time to revisit the topic. In my opinion, things don't run smoothly when the CAN gets stressed.
Hardware: MCP2518 with 4 MHz oscillator, interrupt and 20MHz system clock. (other hardware, without interrupt, 40 MHz,... in previous attempts resulted in the same error in principle)
Very simple attempt, a little hard, but the result produces exactly the errors that otherwise occur sporadically (see the first contributions here).
Use the demo program to send a message:
<https://user-images.githubusercontent.com/59939765/161439502-fc3394ca-82e9-4642-a272-8300b97db8d7.png>
Test 0: ID:0, Data: 0-8, send time 200 micros (60% bus load)
Result: everything ok
Test 1: ID:0, data: 0-8, transmission time 100 micros (100% bus load)
Result: everything ok
(Not all messages can be sent here when the bus is full, but the function is correct for all messages that are sent.)
Test 2: ID:120, data: 0-8, transmission time 100 micros (100% bus load)
Result: error! (if the ID is > 0, ones are shifted here and wrong ID are generated)
Test 3: ID:120, data: f0-f8, transmission time 100 micros (100% bus load)
Result: error! (in addition, incorrect remote frames are now generated if the data contains larger values)
<https://user-images.githubusercontent.com/59939765/161439403-3496803e-9f55-4b35-8b2a-1bfb13e2814f.jpg>
Test 0
<https://user-images.githubusercontent.com/59939765/161440185-c7f79ca3-b8d5-4ed2-af58-7a2467b143b0.jpg>
Test 1
<https://user-images.githubusercontent.com/59939765/161440194-f472706e-fbd6-493b-aeff-2d22a294a1b4.jpg>
Test 2
<https://user-images.githubusercontent.com/59939765/161440205-6c98729b-9dee-4cb2-a650-800fcca36dd6.jpg>
Test 3
—
Reply to this email directly, view it on GitHub <#17 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AEWKZVB3BYBWUS4ONMUSR7LVDHIGZANCNFSM5LQAAAUQ>.
You are receiving this because you commented.
|
Hello Pierre, |
Hello Pierre, but once again about my problem with the transmission errors, because it may not be (only) because of the SPI transmission rate. For this purpose I examined my "good" circuit, which did not generate any errors, i.e. the one with the 20MHz crystal on the MCP and the SPI transmission with 10MHz generated with it. The peculiarity here is that one message is specifically sent in a time interval
ESP32 and MCP2518 with 20MHz crystal, SPI, no interrupt pin, no data is received in the ESP32, it is only sent.
I am sending a message with 6 bytes of data at a frequency of 4 KHz. The CAN runs at 1MBaud, resulting in a bus load of approx. 41%. No other participant on the bus sends further data. Everything works fine, over 10 million messages sent, no errors.
Exactly the same as 1, the following change: the CAN now runs with 500kBaud. This leads to a bus load of approx. 82%. Now errors occur, remote frames are received and also messages that were never sent. (approx. 1 error per 10000 transmissions) The stress with the higher bus load is only caused by the MCP, the SPI transmission does not change. He only sends alone, so he doesn't have to fight for priorities. I can't explain why ...
Exactly the same as 1, the following change: 4 different messages are sent in the program from the ESP to the MCP in direct succession. The transmission frequency for these 4 messages is 1KHz, so the CAN bus load is again at 40%. Now errors arise:
Specifically sent: CAN-ID(hex): 320, 321, 322, 323 - 45000 each,
received: 320 and 321 each 45000, 322: 44992, 323: 44110, additionally the following messages and number on ID(hex): 302: 8; 303: 890 It is noticeable here that the last 2 messages are badly affected.
I have solved the problem by waiting 70µs after each sending of a message before I send the next one. Then it runs without errors. I can't really explain that to myself, because I'm writing in the buffer, but that's how it is.
But that is just a deceptive "good condition". Because if a second device sends data on the bus and the bus load increases again, to around 60%, then these errors occur again.
Do you have any idea? So when the MCP gets stressed, errors occur on the bus. Which settings can you adjust?
Thanks.
The text was updated successfully, but these errors were encountered: