214 UNS32 SINC_cicle=50000;// us |
214 UNS32 SINC_cicle=50000;// us |
215 UNS8 size = sizeof(UNS32); |
215 UNS8 size = sizeof(UNS32); |
216 |
216 |
217 /* The slaves are now configured (nodeId and Baudrate) via the LSS services. |
217 /* The slaves are now configured (nodeId and Baudrate) via the LSS services. |
218 * Switch the LSS state to WAITING and restart the slaves. */ |
218 * Switch the LSS state to WAITING and restart the slaves. */ |
|
219 |
|
220 /*TODO: change the baud rate of the master!!*/ |
219 MasterBoard.baudrate="250K"; |
221 MasterBoard.baudrate="250K"; |
220 |
222 |
|
223 |
221 printf("Master : Switch Delay period finished. Switching to LSS WAITING state\n"); |
224 printf("Master : Switch Delay period finished. Switching to LSS WAITING state\n"); |
222 configNetworkNode(d,LSS_SM_GLOBAL,&LSS_mode,0,NULL); |
225 configNetworkNode(d,LSS_SM_GLOBAL,&LSS_mode,0,NULL); |
223 |
226 |
224 printf("Master : Restarting all the slaves\n"); |
227 printf("Master : Restarting all the slaves\n"); |
225 masterSendNMTstateChange (d, 0x00, NMT_Reset_Node); |
228 masterSendNMTstateChange (d, 0x00, NMT_Reset_Comunication); |
226 |
229 |
227 printf("Master : Starting the SYNC producer\n"); |
230 printf("Master : Starting the SYNC producer\n"); |
228 writeLocalDict( d, /*CO_Data* d*/ |
231 writeLocalDict( d, /*CO_Data* d*/ |
229 0x1006, /*UNS16 index*/ |
232 0x1006, /*UNS16 index*/ |
230 0x00, /*UNS8 subind*/ |
233 0x00, /*UNS8 subind*/ |
340 eprintf("LSS=>identify no-configured remote slave(s)\n"); |
343 eprintf("LSS=>identify no-configured remote slave(s)\n"); |
341 res=configNetworkNode(&TestMaster_Data,LSS_IDENT_REMOTE_NON_CONF,0,0,CheckLSSAndContinue); |
344 res=configNetworkNode(&TestMaster_Data,LSS_IDENT_REMOTE_NON_CONF,0,0,CheckLSSAndContinue); |
342 break; |
345 break; |
343 #ifdef CO_ENABLE_LSS_FS |
346 #ifdef CO_ENABLE_LSS_FS |
344 case 2: /* LSS=>FastScan */ |
347 case 2: /* LSS=>FastScan */ |
|
348 { |
|
349 lss_fs_transfer_t lss_fs; |
345 eprintf("LSS=>FastScan\n"); |
350 eprintf("LSS=>FastScan\n"); |
346 res=configNetworkNode(&TestMaster_Data,LSS_IDENT_FASTSCAN,0,0,CheckLSSAndContinue); |
351 /* The VendorID and ProductCode are partialy known, except the last two digits (8 bits). */ |
347 break; |
352 lss_fs.FS_LSS_ID[0]=Vendor_ID; |
|
353 lss_fs.FS_BitChecked[0]=8; |
|
354 lss_fs.FS_LSS_ID[1]=Product_Code; |
|
355 lss_fs.FS_BitChecked[1]=8; |
|
356 /* serialNumber and RevisionNumber are unknown, i.e. the 8 digits (32bits) are unknown. */ |
|
357 lss_fs.FS_BitChecked[2]=32; |
|
358 lss_fs.FS_BitChecked[3]=32; |
|
359 res=configNetworkNode(&TestMaster_Data,LSS_IDENT_FASTSCAN,&lss_fs,0,CheckLSSAndContinue); |
|
360 } |
|
361 break; |
348 #else |
362 #else |
349 case 2: /* LSS=>identify node */ |
363 case 2: /* LSS=>identify node */ |
350 eprintf("LSS=>identify node\n"); |
364 eprintf("LSS=>identify node\n"); |
351 res=configNetworkNode(&TestMaster_Data,LSS_IDENT_REMOTE_VENDOR,&Vendor_ID,0,NULL); |
365 res=configNetworkNode(&TestMaster_Data,LSS_IDENT_REMOTE_VENDOR,&Vendor_ID,0,NULL); |
352 res=configNetworkNode(&TestMaster_Data,LSS_IDENT_REMOTE_PRODUCT,&Product_Code,0,NULL); |
366 res=configNetworkNode(&TestMaster_Data,LSS_IDENT_REMOTE_PRODUCT,&Product_Code,0,NULL); |