資源簡介
1、該程序為STM32 CAN 雙機通訊實例,接收數(shù)據(jù)時通過中斷程序進行接收的。
2、Node的主芯片為STM32F103ZET,node2的芯片為STM32F103C8. 雙機均工作在正常模式下。為了能夠完整的完成雙機通訊,還需要配備CAN接收器。本例程中采用的是TJA1050 CAN控制芯片.可從網(wǎng)上購買,約6元左右。
3、在運行過程中,只能某一STM32發(fā)送(程序中沒有設(shè)置數(shù)據(jù)重發(fā),因此在兩個節(jié)點的主程序中都有發(fā)送程序的話,會進行總線總裁,失敗方無法再次發(fā)送發(fā)送數(shù)據(jù))。大家可以再我的基礎(chǔ)上進行修改。
4、該程序沒有設(shè)置錯誤處理程序,大家可以進行完善

代碼片段和文件信息
/**
??******************************************************************************
??*?@file????system_stm32f10x.c
??*?@author??MCD?Application?Team
??*?@version?V3.5.0
??*?@date????11-March-2011
??*?@brief???CMSIS?Cortex-M3?Device?Peripheral?Access?layer?System?Source?File.
??*?
??*?1.??This?file?provides?two?functions?and?one?global?variable?to?be?called?from?
??*?????user?application:
??*??????-?SystemInit():?Setups?the?system?clock?(System?clock?source?PLL?Multiplier
??*??????????????????????factors?AHB/APBx?prescalers?and?Flash?settings).?
??*??????????????????????This?function?is?called?at?startup?just?after?reset?and?
??*??????????????????????before?branch?to?main?program.?This?call?is?made?inside
??*??????????????????????the?“startup_stm32f10x_xx.s“?file.
??*
??*??????-?SystemCoreClock?variable:?Contains?the?core?clock?(HCLK)?it?can?be?used
??*??????????????????????????????????by?the?user?application?to?setup?the?SysTick?
??*??????????????????????????????????timer?or?configure?other?parameters.
??*?????????????????????????????????????
??*??????-?SystemCoreClockUpdate():?Updates?the?variable?SystemCoreClock?and?must
??*?????????????????????????????????be?called?whenever?the?core?clock?is?changed
??*?????????????????????????????????during?program?execution.
??*
??*?2.?After?each?device?reset?the?HSI?(8?MHz)?is?used?as?system?clock?source.
??*????Then?SystemInit()?function?is?called?in?“startup_stm32f10x_xx.s“?file?to
??*????configure?the?system?clock?before?to?branch?to?main?program.
??*
??*?3.?If?the?system?clock?source?selected?by?user?fails?to?startup?the?SystemInit()
??*????function?will?do?nothing?and?HSI?still?used?as?system?clock?source.?User?can?
??*????add?some?code?to?deal?with?this?issue?inside?the?SetSysClock()?function.
??*
??*?4.?The?default?value?of?HSE?crystal?is?set?to?8?MHz?(or?25?MHz?depedning?on
??*????the?product?used)?refer?to?“HSE_VALUE“?define?in?“stm32f10x.h“?file.?
??*????When?HSE?is?used?as?system?clock?source?directly?or?through?PLL?and?you
??*????are?using?different?crystal?you?have?to?adapt?the?HSE?value?to?your?own
??*????configuration.
??*????????
??******************************************************************************
??*?@attention
??*
??*?THE?PRESENT?FIRMWARE?WHICH?IS?FOR?GUIDANCE?ONLY?AIMS?AT?PROVIDING?CUSTOMERS
??*?WITH?CODING?INFORMATION?REGARDING?THEIR?PRODUCTS?IN?ORDER?FOR?THEM?TO?SAVE
??*?TIME.?AS?A?RESULT?STMICROELECTRONICS?SHALL?NOT?BE?HELD?LIABLE?FOR?ANY
??*?DIRECT?INDIRECT?OR?CONSEQUENTIAL?DAMAGES?WITH?RESPECT?TO?ANY?CLAIMS?ARISING
??*?FROM?THE?CONTENT?OF?SUCH?FIRMWARE?AND/OR?THE?USE?MADE?BY?CUSTOMERS?OF?THE
??*?CODING?INFORMATION?CONTAINED?HEREIN?IN?CONNECTION?WITH?THEIR?PRODUCTS.
??*
??*?©?COPYRIGHT?2011?STMicroelectronics
??******************************************************************************
??*/
/**?@addtogroup?CMSIS
??*?@{
??*/
/**?@addtogroup?stm32f10x_system
??*?@{
??*
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-05-17?18:20??03_CAN?雙機通訊模式\
?????目錄???????????0??2015-05-17?18:20??03_CAN?雙機通訊模式\01_Node1\
?????目錄???????????0??2015-05-17?18:20??03_CAN?雙機通訊模式\01_Node1\boot\
?????目錄???????????0??2015-05-17?18:20??03_CAN?雙機通訊模式\01_Node1\boot\CM3\
?????文件???????17273??2015-03-28?23:32??03_CAN?雙機通訊模式\01_Node1\boot\CM3\core_cm3.c
?????文件???????85714??2015-03-28?23:32??03_CAN?雙機通訊模式\01_Node1\boot\CM3\core_cm3.h
?????文件???????10308??2015-03-28?23:32??03_CAN?雙機通訊模式\01_Node1\boot\cortexm3_macro.s
?????目錄???????????0??2015-05-17?18:20??03_CAN?雙機通訊模式\01_Node1\boot\startup\
?????文件???????15766??2015-03-28?23:32??03_CAN?雙機通訊模式\01_Node1\boot\startup\startup_stm32f10x_cl.s
?????文件???????15503??2015-03-28?23:32??03_CAN?雙機通訊模式\01_Node1\boot\startup\startup_stm32f10x_hd.s
?????文件???????15692??2015-03-28?23:32??03_CAN?雙機通訊模式\01_Node1\boot\startup\startup_stm32f10x_hd_vl.s
?????文件???????12376??2015-03-28?23:32??03_CAN?雙機通訊模式\01_Node1\boot\startup\startup_stm32f10x_ld.s
?????文件???????13656??2015-03-28?23:32??03_CAN?雙機通訊模式\01_Node1\boot\startup\startup_stm32f10x_ld_vl.s
?????文件???????12765??2015-03-28?23:32??03_CAN?雙機通訊模式\01_Node1\boot\startup\startup_stm32f10x_md.s
?????文件???????14073??2015-03-28?23:32??03_CAN?雙機通訊模式\01_Node1\boot\startup\startup_stm32f10x_md_vl.s
?????文件???????15955??2015-03-28?23:32??03_CAN?雙機通訊模式\01_Node1\boot\startup\startup_stm32f10x_xl.s
?????文件??????633963??2015-03-28?23:32??03_CAN?雙機通訊模式\01_Node1\boot\stm32f10x.h
?????文件???????43513??2015-03-28?23:32??03_CAN?雙機通訊模式\01_Node1\boot\stm32f10x_cl.h
?????文件????????3239??2015-03-28?23:32??03_CAN?雙機通訊模式\01_Node1\boot\stm32f10x_conf.h
?????文件???????12871??2015-03-28?23:32??03_CAN?雙機通訊模式\01_Node1\boot\stm32f10x_vector.s
?????文件???????36557??2015-04-15?15:08??03_CAN?雙機通訊模式\01_Node1\boot\system_stm32f10x.c
?????文件????????2085??2015-03-28?23:32??03_CAN?雙機通訊模式\01_Node1\boot\system_stm32f10x.h
?????文件????????1672??2015-03-28?23:32??03_CAN?雙機通訊模式\01_Node1\boot\system_stm32f10x_cl.h
?????文件????????3741??2015-04-29?16:55??03_CAN?雙機通訊模式\01_Node1\CAN.build_log.htm
?????文件??????137961??2015-05-12?23:39??03_CAN?雙機通訊模式\01_Node1\CAN.uvgui.BobYang
?????文件??????138085??2015-05-12?16:11??03_CAN?雙機通訊模式\01_Node1\CAN.uvgui_BobYang.bak
?????文件???????19235??2015-05-12?23:39??03_CAN?雙機通訊模式\01_Node1\CAN.uvopt
?????文件???????17699??2015-05-07?15:35??03_CAN?雙機通訊模式\01_Node1\CAN.uvproj
?????文件???????19874??2015-05-17?18:17??03_CAN?雙機通訊模式\01_Node1\CAN_CAN.dep
?????文件???????19243??2015-05-12?16:11??03_CAN?雙機通訊模式\01_Node1\CAN_uvopt.bak
?????文件???????17735??2015-05-06?22:51??03_CAN?雙機通訊模式\01_Node1\CAN_uvproj.bak
............此處省略156個文件信息
評論
共有 條評論