Page 1 of 1

Regarding Impementation of CAN on STM32 discovery

Posted: Wed Jan 22, 2020 2:32 pm
by surajkumar.tanurkar
i want to implement CAN protocol on stm32
please help me!!!

thank you!!!

Re: Regarding Impementation of CAN on STM32 discovery

Posted: Wed Jan 22, 2020 11:24 pm
by ag123
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

Re: Regarding Impementation of CAN on STM32 discovery

Posted: Thu Jan 23, 2020 8:51 am
by surajkumar.tanurkar
he is using special module for it.
i dont want to use any type of module.
thank you for your suggestion

Re: Regarding Impementation of CAN on STM32 discovery

Posted: Thu Jan 23, 2020 7:19 pm
by Bingo600
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
What special module ?

I see 2 x STM32 Boards with external CanBus drivers (as normal)

/Bingo

Re: Regarding Impementation of CAN on STM32 discovery

Posted: Sat Jan 25, 2020 7:11 am
by Alan3114
I have just added CAN communication to my project :-)
What do you need help with ?

Re: Regarding Impementation of CAN on STM32 discovery

Posted: Tue Jan 28, 2020 7:07 am
by surajkumar.tanurkar
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!!!

Re: Regarding Impementation of CAN on STM32 discovery

Posted: Tue Jan 28, 2020 3:20 pm
by Bingo600
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!!!
Afaik MCP2515 is a SPI driven Canbus controller.
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

Re: Regarding Impementation of CAN on STM32 discovery

Posted: Thu Jan 30, 2020 12:12 pm
by surajkumar.tanurkar
can you share link for MCP2515 library

Re: Regarding Impementation of CAN on STM32 discovery

Posted: Thu Jan 30, 2020 6:13 pm
by fpiSTM

Re: Regarding Impementation of CAN on STM32 discovery

Posted: Tue Sep 14, 2021 9:24 am
by fawadansari89
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);
}