acan2517FD icon indicating copy to clipboard operation
acan2517FD copied to clipboard

ESP32-S3 + MCP2518FD

Open jblazeg opened this issue 1 year ago • 11 comments

Hi,

I use a custom board and I get "Configuration error 0x10000" - which means timeout initialising the SPI device. Screenshot 2023-11-23 at 10 34 29

But when I disconnect the other can bus device (works - verified) it initializes correctly, but still doesnt send any data (CAN TX line is permanently high, also no CAN receive): Screenshot 2023-11-23 at 10 52 08

Anything else I should capture or add files? CAN Select has a 10K pullup resistor. I use a 40MHz resonator with 22pF capacitors. Tansceiver is a TCAN332.

extract from the code:

SPIClass SPI2(HSPI);

const uint8_t SOFT_SCK_PIN  = 19;
const uint8_t SOFT_MISO_PIN = 20;
const uint8_t SOFT_MOSI_PIN = 21;
#define SELECT 17 
ACAN2517FD can2(SELECT, SPI2, 255)

setup() {

SPI2.begin(SOFT_SCK_PIN,SOFT_MISO_PIN,SOFT_MOSI_PIN);
SPI2.setFrequency(5000000);

ACAN2517FDSettings settings (ACAN2517FDSettings::OSC_40MHz_DIVIDED_BY_2, 125 * 1000, DataBitRateFactor::x4) ;
settings.mRequestedMode = ACAN2517FDSettings::NormalFD; 

const uint32_t errorCode = can2.begin (settings, NULL) ;
}

Cheers

jblazeg avatar Nov 23 '23 09:11 jblazeg

Hello,

I'm afraid I can't help you, the MCP2518 is a temperamental component, and many users have reported difficulties with initialization. Error 0x10000 means that the MCP2518 does not go into configuration mode.

You get different behaviour depending on whether the MCP2518 is connected to the bus or not. Is the electrical ground the same?

Pierre

Le 23 nov. 2023 à 10:59, jblazeg @.***> a écrit :

Hi,

I use a custom board and I get "Configuration error 0x10000" - which means timeout initialising the SPI device. https://user-images.githubusercontent.com/42333542/285160172-a6bce59a-c0ff-4853-9154-4ee26746178a.png But when I disconnect the other can bus device (works - verified) it initializes correctly, but still doesnt send any data (CAN TX line is permanently high, also no CAN receive): https://user-images.githubusercontent.com/42333542/285167009-ef16a7c7-74c3-4c5c-aed9-2a895701916e.png Anything else I should capture or add files? CAN Select has a 10K pullup resistor. I use a 40MHz resonator with 22pF capacitors

extract from the code:

SPIClass SPI2(HSPI);

const uint8_t SOFT_SCK_PIN = 19; const uint8_t SOFT_MISO_PIN = 20; const uint8_t SOFT_MOSI_PIN = 21; #define SELECT 17 ACAN2517FD can2(SELECT, SPI2, 255)

setup() {

SPI2.begin(SOFT_SCK_PIN,SOFT_MISO_PIN,SOFT_MOSI_PIN); SPI2.setFrequency(5000000);

ACAN2517FDSettings settings (ACAN2517FDSettings::OSC_40MHz_DIVIDED_BY_2, 125 * 1000, DataBitRateFactor::x4) ; settings.mRequestedMode = ACAN2517FDSettings::NormalFD;

const uint32_t errorCode = can2.begin (settings, NULL) ; } Cheers

— Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan2517FD/issues/43, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVDC4LF66GZ7EGPGVCTYF4M75AVCNFSM6AAAAAA7XP2LZOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGAYDOOBVGIYDAMA. You are receiving this because you are subscribed to this thread.

pierremolinaro avatar Nov 27 '23 14:11 pierremolinaro

Yes, the behaviour is different. With can bus traffic, the chip does not initialise. But it does not receive/send anything even if it initialises correctly.

Common ground is generally not needed for can bus (differential pair) but I tried with common ground and without - the problem is the same.

jblazeg avatar Nov 27 '23 17:11 jblazeg

hello, i got the same problem and sovled it just now. 292826674-9983767b-1e52-4fdd-bbd6-1708bc15df45 i use this board to learn canfd. and i notice the default setting of this board is: if you use 3.3v voltage, you should provide another 5v voltage. like this: then it shou 292827157-59de0f5e-d702-44fe-ad2c-aac8634a0f45

ld work well.

VergilGao avatar Dec 26 '23 07:12 VergilGao

Could you provide working code example? Thanks!

kukumagi avatar Feb 27 '24 19:02 kukumagi

Your images are empty.

There are several example codes in the library, don't they suit you?

Pierre

Le 27 févr. 2024 à 20:19, kukumagi @.***> a écrit :

https://private-user-images.githubusercontent.com/8655163/292826674-9983767b-1e52-4fdd-bbd6-1708bc15df45.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDkwNjE3NzYsIm5iZiI6MTcwOTA2MTQ3NiwicGF0aCI6Ii84NjU1MTYzLzI5MjgyNjY3NC05OTgzNzY3Yi0xZTUyLTRmZGQtYmJkNi0xNzA4YmMxNWRmNDUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDIyNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDAyMjdUMTkxNzU2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9N2M0N2QwOTVlMmY2NTA5M2FlYmQzOWY5NmE5OTFkYjA2ZTBkZWE0MGM0ZWZhYzc5MDFiNmZmZTlkNDZhNDcxOCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.WVDUGY26JjZTb2-pTsz0u0ajsvrRTy6IkcmPSHZ_6SM hello, i got the same problem and sovled it just now.

i use this board to learn canfd. and i notice the default setting of this board is: if you use 3.3v voltage, you should provide another 5v voltage. like this: https://private-user-images.githubusercontent.com/8655163/292827157-59de0f5e-d702-44fe-ad2c-aac8634a0f45.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDkwNjE3NzYsIm5iZiI6MTcwOTA2MTQ3NiwicGF0aCI6Ii84NjU1MTYzLzI5MjgyNzE1Ny01OWRlMGY1ZS1kNzAyLTQ0ZmUtYWQyYy1hYWM4NjM0YTBmNDUuanBnP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDIyNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDAyMjdUMTkxNzU2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YmQzMThiN2YxZjM1NzM5YjdlNWQwNmEyNDBkZjJjMjc2NjJjNWRiYjg0Y2M1YzQ0ZGU4ZmNhNTUwOWZjMWZhMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.QMPc5_xFygwuek1SEtfpPybBiFsmxD5J1m0_jbpyFII then it should work well.

Could you provide working code example? Thanks!

— Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan2517FD/issues/43#issuecomment-1967434515, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVHNJ46OYRZOVQOP4UTYVYWSTAVCNFSM6AAAAAA7XP2LZOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRXGQZTINJRGU. You are receiving this because you commented.

pierremolinaro avatar Feb 28 '24 09:02 pierremolinaro

I was stuck at frame structure. But already found it.

kukumagi avatar Feb 28 '24 10:02 kukumagi

Your images are empty. There are several example codes in the library, don't they suit you? Pierre Le 27 févr. 2024 à 20:19, kukumagi @.***> a écrit : https://private-user-images.githubusercontent.com/8655163/292826674-9983767b-1e52-4fdd-bbd6-1708bc15df45.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDkwNjE3NzYsIm5iZiI6MTcwOTA2MTQ3NiwicGF0aCI6Ii84NjU1MTYzLzI5MjgyNjY3NC05OTgzNzY3Yi0xZTUyLTRmZGQtYmJkNi0xNzA4YmMxNWRmNDUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDIyNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDAyMjdUMTkxNzU2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9N2M0N2QwOTVlMmY2NTA5M2FlYmQzOWY5NmE5OTFkYjA2ZTBkZWE0MGM0ZWZhYzc5MDFiNmZmZTlkNDZhNDcxOCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.WVDUGY26JjZTb2-pTsz0u0ajsvrRTy6IkcmPSHZ_6SM hello, i got the same problem and sovled it just now. i use this board to learn canfd. and i notice the default setting of this board is: if you use 3.3v voltage, you should provide another 5v voltage. like this: https://private-user-images.githubusercontent.com/8655163/292827157-59de0f5e-d702-44fe-ad2c-aac8634a0f45.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDkwNjE3NzYsIm5iZiI6MTcwOTA2MTQ3NiwicGF0aCI6Ii84NjU1MTYzLzI5MjgyNzE1Ny01OWRlMGY1ZS1kNzAyLTQ0ZmUtYWQyYy1hYWM4NjM0YTBmNDUuanBnP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDIyNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDAyMjdUMTkxNzU2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YmQzMThiN2YxZjM1NzM5YjdlNWQwNmEyNDBkZjJjMjc2NjJjNWRiYjg0Y2M1YzQ0ZGU4ZmNhNTUwOWZjMWZhMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.QMPc5_xFygwuek1SEtfpPybBiFsmxD5J1m0_jbpyFII then it should work well. Could you provide working code example? Thanks! — Reply to this email directly, view it on GitHub <#43 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVHNJ46OYRZOVQOP4UTYVYWSTAVCNFSM6AAAAAA7XP2LZOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRXGQZTINJRGU. You are receiving this because you commented.

could you see the images now?

VergilGao avatar Feb 28 '24 15:02 VergilGao

I am still having trouble with the MCP2518FD Pro board. Sometimes I get configuration error 0x1 and other times I get Configuration error 0x80000

kukumagi avatar Mar 09 '24 15:03 kukumagi

I have a problem with reading and transmitting. It wont start receiving. And the weirdest part is that if I disconnect 5v and then reconnect it somehow starts working. Do I have something wrong in my setup?

kukumagi avatar Mar 22 '24 17:03 kukumagi

I tried espressif 3.0.0-rc1 version and it works perfectly, but with version 2.x it simply does not start transmitting/receiving. Configuration works but no data comes in and unable to send frames.

kukumagi avatar May 04 '24 10:05 kukumagi

I dont know why but calling canfd.poll() after begin() it starts working correctly Eg: const uint32_t errorCode = canfd.begin(settings, [] { canfd.isr(); }); canfd.poll();

kukumagi avatar May 25 '24 12:05 kukumagi