| 数据搜索系统,热门电子元器件搜索 |
|
ST72521 数据表(PDF) 151 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
ST72521 数据表(HTML) 151 Page - STMicroelectronics |
|
151 / 211 page ![]() ST72521 151/211 CONTROLLER AREA NETWORK (Cont’d) Workaround Description The bus-off entry works correctly in almost all cas- es, only when REC is greater than 127 a bus-off will not be recognized by pCAN. Therefore the pCAN bus-off signalling (BOFF) is still used but it needs to be complemented by monitoring TEC by software. To detect the bus-off condition by software the ap- plication has to monitor the value of the TEC reg- ister periodically. An overflow signals a bus-off condition. When a bus-off condition has been de- tected the application must execute the following sequence to recover from bus-off properly: the ap- plication stops pCAN by clearing the RUN bit in the CANCSR register resets all pending transmission by clearing the LOCK bit in the BCSR register and starts it again by setting the RUN bit. To detect the bus-off condition properly, the TEC monitoring period must be lower than the time be- tween two overflows. As the problem only occurs when pCAN is in Error Passive State (REC > 127) pCAN will continuously try to send a SOF followed by an Error Passive Flag and a Suspend Trans- mission. This leads to 26 (1 + 6 + 8 + 3 + 8) bit times. Each time TEC is incremented by 8, hence to reach 256 the sequence must be executed 32 times. Under these conditions the shortest se- quence leading to a TEC overflow lasts 832 bit times. Depending on the baudrate the application will have to adapt the monitoring period, for example at 500kbps the period must be less than 1600us. The ‘C’ code below shows an implementation ex- ample of the monitoring sequence. This code is called periodically as described above. To detect the overflow, the test condition must take into account that TEC might also have been decremented due to a successful transmission. So an overflow condition is detected: IF the current TEC value is lower than the previous TEC value AND the difference is greater than the number of possible successful transmissions during the mon- itoring period. In the example above, one message can be sent, therefore one is added to CANTECR. ************************************************/ /* INITIALISATION /************************************************/ unsigned char TECReg=0; //Previous value of TEC unsigned char BusOffFlag=0; //Set to one if bus-off /************************************************/ /* BUS-OFF MONITORING SEQUENCE /************************************************/ if( (CANCSR & BOFF) || ( CANTECR+1 < TECReg) ) { BusOffFlag = 1; } else { TECReg = CANTECR; } |
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |