1、./TestMasterMicroMod -l ../lib/libcanfestival_can_socket.so -i 0x00 -m 0 -M 500K
- void help(void)
- {
- printf("**************************************************************\n");
- printf("* TestMasterMicroMod *\n");
- printf("* *\n");
- printf("* A simple example for PC. *\n");
- printf("* A CanOpen master that control a MicroMod module: *\n");
- printf("* - setup module TPDO 1 transmit type *\n");
- printf("* - setup module RPDO 1 transmit type *\n");
- printf("* - setup module hearbeatbeat period *\n");
- printf("* - disable others TPDOs *\n");
- printf("* - set state to operational *\n");
- printf("* - send periodic SYNC *\n");
- printf("* - send periodic RPDO 1 to Micromod (digital output) *\n");
- printf("* - listen Micromod's TPDO 1 (digital input) *\n");
- printf("* - Mapping RPDO 1 bit per bit (digital input) *\n");
- printf("* *\n");
- printf("* Usage: *\n");
- printf("* ./TestMasterMicroMod [OPTIONS] *\n");
- printf("* *\n");
- printf("* OPTIONS: *\n");
- printf("* -l : Can library [\"libcanfestival_can_virtual.so\"] *\n");
- printf("* *\n");
- printf("* Slave: *\n");
- printf("* -i : Slave Node id format [0x01 , 0x7F] *\n");
- printf("* *\n");
- printf("* Master: *\n");
- printf("* -m : bus name [\"1\"] *\n");
- printf("* -M : 1M,500K,250K,125K,100K,50K,20K,10K *\n");
- printf("* *\n");
- printf("**************************************************************\n");
- }
void help_menu(void)
{
printf(" MANDATORY COMMAND (must be the first command):\n");
printf(" load#CanLibraryPath,channel,baudrate,nodeid,type (0:slave, 1:master)\n");
printf("\n");
printf(" NETWORK: (if nodeid=0x00 : broadcast)\n");
printf(" ssta#nodeid : Start a node\n");
printf(" ssto#nodeid : Stop a node\n");
printf(" srst#nodeid : Reset a node\n");
printf(" scan : Reset all nodes and print message when bootup\n");
printf(" wait#seconds : Sleep for n seconds\n");
printf("\n");
printf(" SDO: (size in bytes)\n");
printf(" info#nodeid\n");
printf(" rsdo#nodeid,index,subindex : read sdo\n");
printf(" ex : rsdo#42,1018,01\n");
printf(" wsdo#nodeid,index,subindex,size,data : write sdo\n");
printf(" ex : wsdo#42,6200,01,01,FF\n");
printf("\n");
printf(" Note: All numbers are hex\n");
printf("\n");
printf(" help : Display this menu\n");
printf(" quit : Quit application\n");
printf("\n");
printf("\n");
}
3、ifconfig can0 up 启动CAN0
4、ip link set can0 type can bitrate 500000 设置CAN0波特率500K赫兹;
5、./configure --cc=arm-linux-gnueabihf-gcc --arch=arm --os=unix --kerneldir=/usr/src/linux-3.5.7 --prefix=$PWD/myinstall --target=unix --can=socket --timers=unix -- debug=WAR,MSG
配置CANfestival源码,下一步make,make install就行。
6、./objdictedit.py ../examples/TestMasterMicroMod/TestMaster.od
用objdictedit.py工具编辑上一级文件中的TestMasterMicroMod的对象字典。
7、特别注意,主站配置SDO CLIENT!