| 数据搜索系统,热门电子元器件搜索 |
|
ST72521 数据表(PDF) 147 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
ST72521 数据表(HTML) 147 Page - STMicroelectronics |
|
147 / 211 page ![]() ST72521 147/211 CONTROLLER AREA NETWORK (Cont’d) Software Work-around - Devices without Hard- ware Fix: To implement a transmission abort under safe conditions, any reset of the LOCK bit during the critical window (2 bit times) must be avoided. Two different cases have to be considered, either the pCAN enters standby mode after the abort, or the abort is performed and pCAN keeps running. Abort followed by STANDBY mode (RUN=0) In this case, aborting the pending transmissions can safely be done by first entering STANDBY mode and then releasing the transmit buffers. STANDBY mode is entered by resetting the RUN bit in the CSR register and once the current trans- mission attempt, even if it fails due to error or lost arbitration, has been performed, pCAN enters STANDBY mode (RUN=0). Once in STANDBY mode the application can abort all pending trans- missions by resetting the corresponding LOCK bit. Abort while staying in RUN mode (RUN=1) Contrary to the STANDBY case described previ- ously, in the RUN case the application has to han- dle the error or arbitration lost conditions. In case of transmission errors, causing the frame to be transmitted again and again, the application must set the NRTX bit in the CSR register. This will cause pCAN to abort the transmission at the end of the current attempt. In case of arbitration lost, setting the NRTX bit does not abort the transmission, therefore the ap- plication must reset the LOCK bit to abort the transmission. To avoid resetting the LOCK bit dur- ing the critical time window, leading to the problem described at the start of this section, the applica- tion must monitor the BUSY bit in the BCSR regis- ter and reset the LOCK bit just after the falling edge of the BUSY bit. The time between the falling edge of the BUSY bit and the SOF of the next transmission attempt is in any case long enough to guarantee that the LOCK bit is reset before the critical time window. The “C” code sequence below shows the software work-around for both the error and arbitration lost cases. _asm("SIM\n"); // Mask interrupts CANCSR |= NRTX; // Set non automatic retransmission bit while(!(CANBCSR & BUSY) &&// Wait till BUSY bit is set (CANBCSR & RDY) ); // or transmission done while( CANBCSR & BUSY ); // Wait till BUSY bit is reset (falling edge) if( CANBCSR & RDY ) { // transmission still pending -> must be aborted CANBCSR &= ~LOCK; //Arbitration lost => cancel transmission safel while( CANBCSR & RDY );// Wait for unlock confirmed CANCSR &= ~NRTX;// Reset NRTX bit once abort sequence done _asm("RIM\n"); } else { // No more abort required as RDY bit already reset CANCSR &= ~NRTX;// Reset NRTX bit once abort sequence done _asm("RIM\n"); // Enable interrupts } |
|
链接网址 |
| 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 |