Regarding Impementation of CAN on STM32 discovery

Post here first, or if you can't find a relevant section!
Post Reply
surajkumar.tanurkar
Posts: 4
Joined: Wed Jan 22, 2020 2:30 pm

Regarding Impementation of CAN on STM32 discovery

Post by surajkumar.tanurkar »

i want to implement CAN protocol on stm32
please help me!!!

thank you!!!
:|
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: Regarding Impementation of CAN on STM32 discovery

Post 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
surajkumar.tanurkar
Posts: 4
Joined: Wed Jan 22, 2020 2:30 pm

Re: Regarding Impementation of CAN on STM32 discovery

Post by surajkumar.tanurkar »

he is using special module for it.
i dont want to use any type of module.
thank you for your suggestion
:|
Bingo600
Posts: 86
Joined: Sat Dec 21, 2019 3:56 pm

Re: Regarding Impementation of CAN on STM32 discovery

Post 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
Alan3114
Posts: 3
Joined: Fri Jan 24, 2020 9:50 pm

Re: Regarding Impementation of CAN on STM32 discovery

Post by Alan3114 »

I have just added CAN communication to my project :-)
What do you need help with ?
surajkumar.tanurkar
Posts: 4
Joined: Wed Jan 22, 2020 2:30 pm

Re: Regarding Impementation of CAN on STM32 discovery

Post 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!!!
:|
Bingo600
Posts: 86
Joined: Sat Dec 21, 2019 3:56 pm

Re: Regarding Impementation of CAN on STM32 discovery

Post 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
surajkumar.tanurkar
Posts: 4
Joined: Wed Jan 22, 2020 2:30 pm

Re: Regarding Impementation of CAN on STM32 discovery

Post by surajkumar.tanurkar »

can you share link for MCP2515 library
:|
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Regarding Impementation of CAN on STM32 discovery

Post by fpiSTM »

fawadansari89
Posts: 2
Joined: Tue Sep 14, 2021 8:34 am

Re: Regarding Impementation of CAN on STM32 discovery

Post 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);
}
Post Reply

Return to “General discussion”