2011-01-26 01:48 AM
2011-05-17 05:23 AM
Hi!
I don't use ST Libraries so I'm going to describe you the steps I use to configure CAN: 1) Enable CAN peripheral clock (RCC_APB1ENR) 2) Enable CAN pins port (RCC_APB2ENR) 3) Configure RX pin as pull up input and TX as alternate pushpull 4) Configure some options (CANx_MCR) 5) Configure CAN baudrate (CANx_BTR) 6) Configure reception filters Pay attention here! If you're not receiveing messages your filtering scheme could be configured in a wrong way. 6.a) make sure CAN is in INIT mode (CAN_MCR) 6.b) disable filter (CANx_FA1R) 6.c) choose 16 or 32 bits mode (CANx_FS1R) 6.d) configure start filter bank if its necessary (CAN_FMR) 6.e) choose filter mode: mask or id mode (CAN_FM1R) 6.f) choose FIFO destination (CAN_FFA1R) 6.g) choose filter ID or mask (CAN_FxRx) 6.h) dont forget to choose 11 or 29 bits ID (CAN_FxRx) 6.i) Initialize filter (CAN_FA1R) 7) enable CAN IRQ (CANx_IER). Don't forget NVIC enabling! 8) Enable CAN by putting this on normal mode (CAN_MCR) 9) Enable global interrupts After that your CAN should work. For testing purposes, set your receiving filter as mask mode assuring the mask receives all IDs! Hope this helps.2011-05-17 05:23 AM
Thanks for the answer, I think I will be able to build it following these steps. :)
2011-05-17 05:23 AM
Hi,
It's me again I have followed the hangar instruccions but I hae met with an strange problem. With the following code that I attach later I've get to trigger the interrupt recpection of can IRQ and every thing seems right with my demoboard. But when I try to insert the same code in my application board it doesn't work.
I've tested it and I receive the same signal at the same point so it should work, being the same code.
The only difference is that in my demoboard I got a STM32F103RB instead of the STM32F103RC that I use in my application board, which it means that I have to change the target micro in my keil options.
As I got an old keil version of keil it could be a problem of libraries ut I'm not sure. I need to know where is the problem.
About the source libraries I've seen that in st repositories there is an standard library but I don't know how to ''introduce'' it in my keil software or use to create a new program with keil. Any one could tell me where I can find an explanantion of how to use this libraries?
Any way I don't know if this is the problem, any idea?.
2011-10-11 10:56 AM
Hagar:
I understand the problem and hope you have it resolved by now. We have designed several J1939 adapters, some of them use the STM32F. If you need any J1939 adapters (RS-232, USB, Wireless), please see these white pages.Thanks,JR2012-10-05 02:56 AM
Hey guys!I am using a STM32f103CB microcontroller .I am not using any evaluation board.I have just placed my microcontroller in a circuit!
After initializing my CAN ,The CAN transmit pin simply goes Low and I can't see the message I am sending through an infinite loop using the CAN_transmit() function on the oscilloscope....Please help! ________________ Attachments : CANbus.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I1Kx&d=%2Fa%2F0X0000000blV%2FUkZFv2JcqoJNwY1sh4Ok6RaSzdLKrXZ1X_ueAShnzek&asPdf=false2012-10-05 07:58 AM
After initializing my CAN ,The CAN transmit pin simply goes Low and I can't see the message I am sending through an infinite loop using the CAN_transmit() function on the oscilloscope....Please help!
Why are you remapping the CAN? The DEFAULT pins are PA11 (CANRX) PA12 (CANTX). Remapping would put them some place else.
2012-10-08 02:03 AM
okay!What you have just said makes sense and I gonna try it right now!Thanks!
2012-10-08 02:16 AM
Have you written a software with the CAN bus tx and reception using the stm32f103cb before?Please attach it so that I can see where I am wrong!thx
2012-10-08 09:49 AM
Not so much, I've done it on an F2 board.
Make sure you've got your transceiver setup correctly, and that you are not in loop back mode. You could review the example under STM32F10x_StdPeriph_Lib_V3.5.0\Project\STM32F10x_StdPeriph_Examples\CAN