This tutorial shows how to communicate between two STM32 boards over CAN bus. Here is a link to tutorial attachments: github.com/MYaqoobEmbedded/ST... STM32 CAN bus Filters configuration forum link: community.st.com/s/question/0...
Nice Job sir. I have used STCubeMX before and its cross compiler IDE from ST before. I've seen issues with the derived clocks for USB, for instance, where it fails to write the correct config out, but it is mostly pretty nice. I haven't used the KEIL IDE, but the generated source from the CUBE tool is very familiar. And your presentation is nice in that you don't just sit there rambling on. You keep it abbreviated and informative. If we need to hear it again, we just hit pause and rollback. Thanks for your time sharing this implementation.
Thanks for the video. here are some bookmarks: 4:03 changing the default CAN pins 6:18 changing the Cube_FW_F4... 7:47 static CanRxMsgTypeDef myRxMessage; 9:50 the inside of : CanTxMsgTypeDef 14:28 call CAN_filterConfig() in start of the main 16:22 Start listening for CAN traffic with IT 28:45 filterConfig.FilterIdHigh = 0x124 Alow
Hi the driver for the F1 and F4 are very much changed now. They are better. When you create a can bus problem with your version by disconnect or short circuit the high and low lines sometimes the incoming irq will stop or no more messages are send. You need to re enable them in the error irq. The data is no longer pointed in the hcan1 It is a separate parameter just like other hal funcions have.
Thanks for the video, was helpful in many aspects. Can I ask how one would decide on the IDs if there were three nodes instead of two? You said for this application, the IDs are switched but I don't quite get how I can implement this for a multi-node system
Hi I am trying to implement can in stm32f103 ,try to communicate 2 stm32f1 in normal mode so i want to ask does we need a tranceiver to for canh and canl .secondly i have a can analzyer so where i should wired it up to see data is it on canh and canl
In general how do you calculate/calibrate the Time Quanta segment 1,2? Similarly, how do you know what value to use for banknumber? If you have multiple devices on the bus, any device can transmit (and/or acknowledge a received message) at any time? The chip takes care of making sure there is no contention when it transmits? Regarding the stability of the can firmware version 1.18.. do you think that applies to all stm32 devices, or just the f4? Is it possible to do use a DMA to automatically transfer received CAN messages to RAM and/or FLASH, without cpu intervention? Or conversely, for the DMA to automatically transfer from an A/D directly to a CAN bus message? BTW, looking at the mutex-embedded and GitHub (MostafaOkasha moggiozzi).. do you have any plans for more video tutorials (1-22)?
Use this calculator www.bittiming.can-wiki.info/ and select STM32 bxCAN and your clock e.g. 48MHz. Essentially you want to use the prescaler to set your baud rate and then you adjust the timing of where each bit is sampled (e.g. do you want to sample halfway through the bit, or close the the end of a bit) using the segments. More info here: st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HxuS&d=%2Fa%2F0X0000000b28%2FOa5m1KEqVQ1Xg4yxLQUNFFR.40q3lDem2bmMMYWL6ns&asPdf=false
Hi, can you tell me if you have any additional information that might help me. I am trying to make a HID gamepad joystick work i'v watched your tutorial and read usb org and the site you used in the HID video but I cannot get the report populated correctly. Also my ability to debug this has been very difficult.
Hi, There are a lot of things go into this,, I recommend you start with joystick USB descriptor written by others and already tested, then try making yours in a similar way or things like that. Hope this helps. Regards
Hello, Mutex!!!Please, give me a hint. I want to transmit message via CAN2, the same message perfectly is transmitted via CAN1, but when I add CAN2 to transmit the similar message, it is not transmitted. I use STM32F407 Discovery board.
Many thanks @MYaqoob Before watching this awesome video, you need to read the following link guys : www.keil.com/download/files/canprimer_v2.pdf Good luck :D
Has there been update to HAL library? Whenever I try to build the project it gives me this error: "../Core/Src/main.c:54:8: error: unknown type name 'CanTxMsgTypeDef' " - I have followed all the steps you outlined.
This HAL library is outdated, data structures and mechanisms of sending data, reception and callbacks has changed. Many times I use your videos as a reference, much appreciation for your videos, basic but solid, and reliable content, except this single video :( Would you mind creating a new version of this example using latest HAL?
Strange, I am getting a HAL_TIMEOUT ,when I try to send a message through the can with HAL_CAN_Transmit(&hcan1, 20) , I am using MCP2551 as transceiver , have you had such issue ?
@@mutexembedded2206 Thanks for your answer. Would you mind provide more information (a useful link is also enough) about the differential side of a CAN bus?
STM32 has 2 pins, Rx and Tx, those pins are single-ended and are used each only for transmitting and receiving. The CAN transceiver transforms the single-ended transmitting signal from the microprocesor into a differential pair signal, which the CAN bus consists of, and also converts the bus signal into a single-ended signal for the receiving.
@@GurpreetSingh-wo2tz it's called multiplexing the information. turn the 1st byte into the multiplex id, and 2nd-8th bytes actually be data. id 0x123, 00 [data 1-7], 0x123, 01 [data 8-14] ,etc.
Sir, could you please share the firmware of stm32cube v1.18.0? I have tried to find it through google but unfortunately, the available version to be downloaded are v1.23.0 and v1.24.0. p/s: Nevermind, I have found and downloaded the v1.18.0 package. Thanks for the video!
@@karankolhe3370 just open the stm32cube mx, then go to help, there you will find embedded package, click it and there will be option to choose which package you want to download
I had the same issue. Here is how I fixed it: 1. Go into "Project Manager", then under the "Project" tab, there is a option which says "Use Default Firmware Location" Turn this off. And specify firmware version 1.18 like he did in the video. 2. Ah but you won't have v1.18 there, just like me. So go into the help menu at the top of the program, select "Embedded Software Packages Manager" and in there you can see all the firmwares available and which ones you have installed. Install the one for your series of micocontroller (I'm using a STMF446RE so I install the STM32F4 series firmware), install version v1.18. 3. Go back to the "project manager", and under the "project" tab now select the firmware location and choose the new folder that has been created, for me this was: C:\Users\username\STM32Cube\Repository\STM32Cube_FW_F4_V1.18.0 4. Generate the code, go back to your IDE, reload it and you will now see that CanRxMsgTypeDef is now defined in stm32f4xx_hal_can.h
I should also add there is a bug you may run into on V1.18, it is detailed here with the new variable names in the replies below on the forum here: community.st.com/s/question/0D50X00009hmRTTSA2/bug-report-stm32f4-cube-1180-hal-can-driver-generates-incorrect-code
@@jotham123 Oh sorry, I meant Pavol. Your instructions look good though if he is using the F4 series too. The link you posted was very interesting, I do think the new CAN driver should be used rather than going back to 1.18.
Enought of keil - what for discovery is need, when you can use only 32KB of code+data in the microcontroller which have over 500 KB of flash. No one hobbyist will purchase this for $5K. In keil don't even embedd simple bmp graphics into flash, which take over of max size offered by keil compiler. You should put maybe first 3 lessons do it on the keil and going up to any GCC unlimited environment. Don't killing me by keil please. Except the keil - very good tutorial.