Regarding Impementation of CAN on STM32 discovery
-
- Posts: 4
- Joined: Wed Jan 22, 2020 2:30 pm
Regarding Impementation of CAN on STM32 discovery
i want to implement CAN protocol on stm32
please help me!!!
thank you!!!
please help me!!!
thank you!!!

Re: Regarding Impementation of CAN on STM32 discovery
a forumer here is doing a much bigger can based project here. i'd guess you could join the effort to learn the ropes
viewtopic.php?f=10&t=99
disclaimer i'm noob about can
viewtopic.php?f=10&t=99
disclaimer i'm noob about can
-
- Posts: 4
- Joined: Wed Jan 22, 2020 2:30 pm
Re: Regarding Impementation of CAN on STM32 discovery
he is using special module for it.
i dont want to use any type of module.
thank you for your suggestion
i dont want to use any type of module.
thank you for your suggestion

Re: Regarding Impementation of CAN on STM32 discovery
What special module ?surajkumar.tanurkar wrote: Thu Jan 23, 2020 8:51 am he is using special module for it.
i dont want to use any type of module.
thank you for your suggestion
I see 2 x STM32 Boards with external CanBus drivers (as normal)
/Bingo
Re: Regarding Impementation of CAN on STM32 discovery
I have just added CAN communication to my project 
What do you need help with ?

What do you need help with ?
-
- Posts: 4
- Joined: Wed Jan 22, 2020 2:30 pm
Re: Regarding Impementation of CAN on STM32 discovery
i am using two stm32f407 and two mcp2515 and ide using is arduino and iwant to send one stm32f407 data another stm32 using can bus so help me out
thank you!!!
thank you!!!

Re: Regarding Impementation of CAN on STM32 discovery
Afaik MCP2515 is a SPI driven Canbus controller.surajkumar.tanurkar wrote: Tue Jan 28, 2020 7:07 am i am using two stm32f407 and two mcp2515 and ide using is arduino and iwant to send one stm32f407 data another stm32 using can bus so help me out
thank you!!!
Doesn't the F407 have a built in canbus interface available ??
I'm quite sure there are Arduin0 libs for the mcp2515 , if that is the way you wish to go.
/Bingo
-
- Posts: 4
- Joined: Wed Jan 22, 2020 2:30 pm
-
- Posts: 2
- Joined: Tue Sep 14, 2021 8:34 am
Re: Regarding Impementation of CAN on STM32 discovery
Hi I need
help with using MCP2515 library, this is my sketch my BLUEPILL is not responding to it
kindly guide me also what pins to use for SPI communication
#include <SPI.h> //Library for using SPI Communication
#include <mcp2515.h> //Library for using CAN Communication
struct can_frame canMsg;
MCP2515 mcp2515(PA4);
void setup()
{
while (!Serial);
Serial.begin(9600);
SPI.begin(); //Begins SPI communication
mcp2515.reset();
mcp2515.setBitrate(CAN_500KBPS,MCP_8MHZ); //Sets CAN at speed 500KBPS and Clock 8MHz
mcp2515.setNormalMode();
canMsg.can_id = 0x036; //CAN id as 0x036
canMsg.can_dlc = 1; //CAN data length as 8
}
void loop()
{
int pot = analogRead(A3);
pot = map(pot,0, 1023, 0, 255);
canMsg.data[0] = pot; //Update humidity value in [0]
mcp2515.sendMessage(&canMsg); //Sends the CAN message
delay(1000);
}
help with using MCP2515 library, this is my sketch my BLUEPILL is not responding to it
kindly guide me also what pins to use for SPI communication
#include <SPI.h> //Library for using SPI Communication
#include <mcp2515.h> //Library for using CAN Communication
struct can_frame canMsg;
MCP2515 mcp2515(PA4);
void setup()
{
while (!Serial);
Serial.begin(9600);
SPI.begin(); //Begins SPI communication
mcp2515.reset();
mcp2515.setBitrate(CAN_500KBPS,MCP_8MHZ); //Sets CAN at speed 500KBPS and Clock 8MHz
mcp2515.setNormalMode();
canMsg.can_id = 0x036; //CAN id as 0x036
canMsg.can_dlc = 1; //CAN data length as 8
}
void loop()
{
int pot = analogRead(A3);
pot = map(pot,0, 1023, 0, 255);
canMsg.data[0] = pot; //Update humidity value in [0]
mcp2515.sendMessage(&canMsg); //Sends the CAN message
delay(1000);
}