Stalled on bus operation

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Stalled on bus operation

2,961 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Caradhras on Fri Apr 20 05:09:59 MST 2012
Hi,

While running my target in debug mode (LPC11C24) I randomly get the message "stalled on bus operation" in the status bar of LPCXpresso. And to the right of it the text "Error reporter" flashes randomly. The application on the mcu seems to work fine.

I just have a strange problem with the can_rx interrupt handler not entering when receiving a message after some time of operation. But this sometimes does not happen at all. I can't really reproduce the error.

Maybe it does have something to do with my problem? My project is based on the can_onchip example from NXP...

Regards
Caradhras
0 项奖励
回复
21 回复数

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Apr 26 06:51:41 MST 2012

Quote: Caradhras
Could please someone see, if i did it right?



Are you kidding? If you insert 0x1C05 (= 500kHz as mentioned above), is it calculating right?

Of course K2 and K3 are wrong :confused:
0 项奖励
回复

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Caradhras on Thu Apr 26 06:14:24 MST 2012
Hi,

for a better understanding of the baud rate settings i tried to write a simple openoffice calculator. it is not yet completed, but should cover the effects of the the different settings on baudrate and sample point.

Could please someone see, if i did it right?
0 项奖励
回复

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Tue Apr 24 11:28:40 MST 2012
Of course I'm talking about:


Quote:

0x[COLOR=Red]1C05[/COLOR]UL  // CAN_BTR

All bits > bit14 are reserved :eek:
0 项奖励
回复

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Caradhras on Tue Apr 24 10:02:58 MST 2012

Quote:

Originally Posted by [B]Caradhras[/B] [IMG]http://knowledgebase.nxp.com/images/buttons/viewpost.gif[/IMG]
[I]Is this a valid configuration for Sample Point 87,5% and 500 Kbits:

uint32_t ClkInitTable[2] =
{
        // 500 kbit/s
    0x00000000UL, // CANCLKDIV
    0x001C0005UL  // CAN_BTR
};[/I]
     It is valid for 48MHz main clock :)



Just tested it with loopback and silent mode. It jumps straight to the error handler. which says 0x87. which tells me "wrong bit transmitted". My SystemCoreClock is 48 MHz... :confused:
0 项奖励
回复

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Tue Apr 24 07:29:21 MST 2012

Quote: Caradhras
Is this a valid configuration for Sample Point 87,5% and 500 Kbits:

uint32_t ClkInitTable[2] =
{
        // 500 kbit/s
    0x00000000UL, // CANCLKDIV
    0x001C0005UL  // CAN_BTR
};



It is valid for 48MHz main clock :)



Quote: Caradhras
I find it hard to understand, how the bitrates are correctly calculated.  I ve got the C_CAN-Manual and all, but i just want working  timings....arghs.:confused:



It's explained here:

http://knowledgebase.nxp.com/showthread.php?t=2829 :eek:


Quote: Caradhras
At a  certain point the controller resigns and recieives no more  messages.



Then your error_info is CAN_ERROR_BOFF 0x00000004UL ;)
0 项奖励
回复

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Caradhras on Tue Apr 24 07:08:14 MST 2012
Is this a valid configuration for Sample Point 87,5% and 500 Kbits:

uint32_t ClkInitTable[2] =
{
        // 500 kbit/s
    0x00000000UL, // CANCLKDIV
    0x001C0005UL  // CAN_BTR
};

I find it hard to understand, how the bitrates are correctly calculated. I ve got the C_CAN-Manual and all, but i just want working timings....arghs.:confused:

My theory is, that the timings of the CAN-Nodes silghtly differ, so most of the time, the bus works and sometimes, i get errorframes. At a certain point the controller resigns and recieives no more messages.
0 项奖励
回复

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Tue Apr 24 06:55:34 MST 2012

Quote: Caradhras
...error-LED is lit.



That's your problem, there are 8 LEDs missing :rolleyes:


Quote:

// error status bits
#define CAN_ERROR_PASS 0x00000001UL
#define CAN_ERROR_WARN 0x00000002UL
#define CAN_ERROR_BOFF 0x00000004UL
#define CAN_ERROR_STUF 0x00000008UL
#define CAN_ERROR_FORM 0x00000010UL
#define CAN_ERROR_ACK 0x00000020UL
#define CAN_ERROR_BIT1 0x00000040UL
#define CAN_ERROR_BIT0 0x00000080UL
#define CAN_ERROR_CRC 0x00000100UL

Although I still like LEDs I would suggest to cast your error_info to 16bit and store it in an nice little array.

With additional time stamp info you can print it via UART or just read it with debugger

//CAN error
void CAN_error(uint32_t error_info){}
0 项奖励
回复

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Caradhras on Tue Apr 24 05:30:06 MST 2012
Thanks! I was able to debug my MCU, without resetting it.

Now, i just have to find my little dirty error that ruins the party... :D
0 项奖励
回复

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by whitecoe on Tue Apr 24 05:22:59 MST 2012

Quote: Caradhras

Is it this? http://support.code-red-tech.com/CodeRedWiki/DebugRunningSystem

Ok, tested. It does.

So i went into debug mode and everything seems to be properly working exept, that it never enters the CAN_rx()-IRQ_Handler... :(


You might want to see the comment from CodeRed in this thread...

http://knowledgebase.nxp.com/showthread.php?t=2787

HTH!
0 项奖励
回复

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Caradhras on Tue Apr 24 05:17:40 MST 2012
Just made a test this morning, still freezes after an indefinite time of operation. Since i did not watch it all day long, i dont know, when it froze.

Is it possible to enter debug mode, without reseting the device? So i can have a look what went wrong.

Is it this? http://support.code-red-tech.com/CodeRedWiki/DebugRunningSystem

Ok, tested. It does.

So i went into debug mode and everything seems to be properly working exept, that it never enters the CAN_rx()-IRQ_Handler... :(

It seems that there was an error on the CAN-Bus, since my error-LED is lit. It may be helpful, if i reinitialize the CAN-Controller, if an error happens on the bus...and i have to see, if there is still something going on on the bus... hmm :confused:
0 项奖励
回复

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Caradhras on Sat Apr 21 03:42:39 MST 2012
What you posted there is from the generated linker skripts. You dont need them as posted from Zero above.

Just put the

//reserve ROM-RAM 0x1000 0050 - 0x1000 00B9
__BSS(RESERVED) char CAN_driver_memory[0xC0];

in your main.c and activate the automatic linker skript management in your project properties.
0 项奖励
回复

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by researchinnovation on Fri Apr 20 22:37:13 MST 2012
@Caradhras....
Hi.. Where did you place the following code in your project, I mean in which file
or driver file. Can you please share the information.

Thanks...:)

/*
* GENERATED FILE - DO NOT EDIT
* (C) Code Red Technologies Ltd, 2008-9
* Generated linker script include file for
* (created from LinkMemoryTemplate (v3.1.4 (200912230917)) on Mon Jan 11 14:36:17 PST 2010)
*/

MEMORY
{
  /* Define each memory region */
  MFlash32 (rx) : ORIGIN = 0x0, LENGTH = 0x7000 /* 32k */
  RamLoc8 (rwx) : ORIGIN = 0x10000100, LENGTH = 0x1F00 /* 8k-256bytes */

}
  /* Define a symbol for the top of each memory region */
  __top_MFlash32 = 0x0 + 0x7000;
  __top_RamLoc8 = 0x10000100 + 0x1F00;
[SIZE=4][B][COLOR=Blue]OR,[/COLOR][/B][/SIZE]
/*  * GENERATED FILE - DO NOT EDIT  * (C) Code Red Technologies Ltd,  2008-9      * Generated C linker script file for LPC1343   * (created  from nxp_lpc13_c.ld (v3.1.4 (200912230917)) on Mon Jan 11 14:36:17 PST  2010) */  INCLUDE "../linker/lpc1114_lib_flash_crp.ld" INCLUDE  "../linker/lpc1114_mem_flash_can_crp.ld"  ENTRY(ResetISR)  SECTIONS {      .text :     {         FILL(0xFF);         KEEP(*(.isr_vector))          *(.text.Reset_Handler .text.SystemInit)         . = 0x000002FC;          KEEP(*(.crp))         *(.text*)         *(.rodata*)      } >  MFlash32       /* for exception handling/unwind - some Newlib functions  (in common with C++ and STDC++) use this. */          .ARM.extab :       {         *(.ARM.extab* .gnu.linkonce.armextab.*)     } >  MFlash32      __exidx_start = .;     .ARM.exidx :     {          *(.ARM.exidx* .gnu.linkonce.armexidx.*)     } > MFlash32      __exidx_end = .;      _etext = .;              .data : AT  (__exidx_end)     {         _data = .;         *(vtable)          *(.data*)         _edata = .;     } > RamLoc8      /* zero  initialized data */     .bss :     {         _bss = .;         *(.bss*)          *(COMMON)         _ebss = .;     } > RamLoc8          /*  Where we put the heap with cr_clib */     .cr_heap :     {         end =  .;         _pvHeapStart = .;     } > RamLoc8      _vRamTop =  __top_RamLoc8 ;     _vStackTop = _vRamTop; }
0 项奖励
回复

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by researchinnovation on Fri Apr 20 22:33:50 MST 2012
@Caradhras....
Hi.. Where did you place the following code in your project, I mean in which file
or driver file. Can you please share the information.

Thanks...:)



/*  * GENERATED FILE - DO NOT EDIT  * (C) Code Red Technologies Ltd, 2008-9      * Generated C linker script file for LPC1343   * (created from nxp_lpc13_c.ld (v3.1.4 (200912230917)) on Mon Jan 11 14:36:17 PST 2010) */  INCLUDE "../linker/lpc1114_lib_flash_crp.ld" INCLUDE "../linker/lpc1114_mem_flash_can_crp.ld"  ENTRY(ResetISR)  SECTIONS { .text : { FILL(0xFF); KEEP(*(.isr_vector)) *(.text.Reset_Handler .text.SystemInit) . = 0x000002FC; KEEP(*(.crp)) *(.text*) *(.rodata*)  } > MFlash32   /* for exception handling/unwind - some Newlib functions (in common with C++ and STDC++) use this. */  .ARM.extab :  { *(.ARM.extab* .gnu.linkonce.armextab.*) } > MFlash32  __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } > MFlash32 __exidx_end = .;  _etext = .;  .data : AT (__exidx_end) { _data = .; *(vtable) *(.data*) _edata = .; } > RamLoc8  /* zero initialized data */ .bss : { _bss = .; *(.bss*) *(COMMON) _ebss = .; } > RamLoc8  /* Where we put the heap with cr_clib */ .cr_heap : { end = .; _pvHeapStart = .; } > RamLoc8  _vRamTop = __top_RamLoc8 ; _vStackTop = _vRamTop; }
0 项奖励
回复

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Caradhras on Fri Apr 20 08:14:59 MST 2012
Ok thanks,

it compiled and is working. I will report back, if I get any strange errors, but dont hope so... ;)

But what about "stalled on bus operation"? I dont have any idea, what this message means... :confused: I get it all the time, no matter what xpresso-board i use.
0 项奖励
回复

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Apr 20 06:49:11 MST 2012

Quote: Caradhras
is that all? asking just to be safe



Yes, that's all :)

The original sample is a little bit old. So if you create a new project this crp stuff is included already ;)

So there's no need to use an own linker script :rolleyes: All my LPC11Cxx nodes and tools are working with 'Managed linker script' :eek:
0 项奖励
回复

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Caradhras on Fri Apr 20 06:42:24 MST 2012
So, if i want it to do it your way:

1. activate Manage Linker Skripts
2. include crp.h in main.c
3. include cr_section_macros.h in main.c
4. put

//reserve ROM-RAM 0x1000 0050 - 0x1000 00B9
__BSS(RESERVED) char CAN_driver_memory[0xC0];

somewhere in main.c at the beginning.

is that all? asking just to be safe ;)
0 项奖励
回复

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Caradhras on Fri Apr 20 06:27:34 MST 2012
Ah, i found it:

MEMORY
{
  /* Define each memory region */
  MFlash32 (rx) : ORIGIN = 0x0, LENGTH = 0x8000 /* 32k */
  RamLoc8 (rwx) : ORIGIN = 0x10000000, LENGTH = 0x2000 /* 8k bytes */

}
  /* Define a symbol for the top of each memory region */
  __top_MFlash32 = 0x0 + 0x8000;
  __top_RamLoc8 = 0x10000100 + 0x1F00;

from the lpc1114_mem_flash_can_crp.ld

It does not look like memory is correctly reserved :eek:
0 项奖励
回复

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Apr 20 06:22:37 MST 2012

Quote: Caradhras
Where should they be if correctly set up?



There are several ways to do that :rolleyes:

If you use 'Managed Linker Script' with CMSIS you can just define it in your main:

#include <cr_section_macros.h>
#include <NXP/crp.h>

//reserve ROM-RAM 0x1000 0050 - 0x1000 00B9
__BSS(RESERVED) char CAN_driver_memory[0xC0];
Also it's a good idea to increase 'Stack offset' to 32
0 项奖励
回复

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Caradhras on Fri Apr 20 06:13:07 MST 2012
Hey, thanks for your answers.

When i began with my project, I found out, that the example project correctly reserved the RAM for the onchip-can-drivers. So this didnt came to my mind again.

But now I am confused, since the .ld's seem not to be where they used to be. And the only ld's i found where excluded from the build. :eek:

Where should they be if correctly set up?
0 项奖励
回复

2,566 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by researchinnovation on Fri Apr 20 05:24:22 MST 2012
Hi....!!!

Just close the workbench and restart the LPCxpresso and open a new workspace at different location/path.
It might help you....:)
0 项奖励
回复