How to debug "Bus error" in ZigBee JN5169?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to debug "Bus error" in ZigBee JN5169?

Jump to solution
1,798 Views
YeelongWong
Contributor III

Hi,there

When I add code in a new task to read data from UART1 of JN5169, the debug console outputs like this:

==================================================

angle =2.294
Bus error
EPCR = 2358ef : EEAR = 2358ef
Stack dump:
4007f10 : 0000000b
4007f14 : 000a3290
4007f18 : 000a31fc
4007f1c : 000a5b08
4007f20 : 00000000
4007f24 : 000a58fe
4007f28 : 000a3281
4007f2c : 00000000
4007f30 : 000a2790
4007f34 : 00000019
4007f38 : 000a5a1f
4007f3c : bceee9fe
4007f40 : 002358ef
4007f44 : 000af839
4007f48 : 097a5552
4007f4c : 00000000
4007f50 : 00003909
4007f54 : e95553c7
4007f58 : 5566d0bf
4007f5c : 00083725
4007f60 : 0000c605
4007f64 : 00000000
4007f68 : 000a5b08
4007f6c : 00000000
4007f70 : bceee9fe
4007f74 : 000a584c
4007f78 : 55000000
4007f7c : 00000000
4007f80 : 00027100
4007f84 : 000a2796
4007f88 : 000a5b08
4007f8c : 00000000
4007f90 : 000a5930
4007f94 : 000a31f3
4007f98 : 0000b7f8
4007f9c : 00000001
4007fa0 : 00000019
4007fa4 : 000a5921
4007fa8 : bceee9fe
4007fac : 000a584c
4007fb0 : 00000001
4007fb4 : 00000000
4007fb8 : fffffffc
4007fbc : 000a317b
4007fc0 : 0000c005
4007fc4 : 00000000
4007fc8 : 000a3169
4007fcc : fe1c897f
4007fd0 : 0008d168
4007fd4 : 00082e51
4007fd8 : 00082e24
4007fdc : 00085d6d
4007fe0 : 000845d5
4007fe4 : 000a2796
4007fe8 : 00001ae8
4007fec : 00000000
4007ff0 : 00000000
4007ff4 : 000a2e30
4007ff8 : 76543210
ÿ4007ffc : fedcba98

APP: Light Power Up

APP_vInitialiseNode*
Reading Dim Level Status: 0 - Bytes Read: 1
Dim Level: 241Restart Running

APP: InitManageTemperature

POR Identify

E_RUNNING

==================================================

I search the address in the map file, but no certain function in the file.

Could anyone help tell me why and how to debug with it?

Tks soooooo much!!!

 

0 Kudos
1 Solution
1,671 Views
YeelongWong
Contributor III

Hi,all


I found the root cause and sovled this problem.

 

Firstly, the official lib API vAHI_UartSetBaudRate with 115200 CAN NOT work well.
Because the UART clock is routed from 16MHz peripheral clock.
As it is said in JN-UG-3087, 115200 is just a approximant.
After my research, if you want to use 115200 you should use the code below:
/* SetBaudRate to 115200 */
vAHI_UartSetBaudDivisor(UART, 23);
vAHI_UartSetClocksPerBit(UART, 5);
instead of vAHI_UartSetBaudRate(UART, E_AHI_UART_RATE_115200)!!!
It seems that vAHI_UartSetBaudRate set BaudDivisor to 9! I think 23 is better and it is with my actual code.

In the same way, if you want to use 9600bps, please use:
/* SetBaudRate to 9600 */
vAHI_UartSetBaudDivisor(GSENSOR_UART, 119);
vAHI_UartSetClocksPerBit(GSENSOR_UART, 13);


Secondly, JN5169 can not undertake the huge data flood, so be careful if the other node outputs lots of data.
In my project, I decreased the datarate of the other device.

Thirdly, by the way, the UART1 TX pin is used in JN-AN-1189-ZigBee-HA-Demo\Common_Light\Source\DriverBulb\DriverBulb_DR1175.c.
in PUBLIC void DriverBulb_vInit(void):

PUBLIC void DriverBulb_vInit(void)
{
static bool_t bFirstCalled = TRUE;

if (bFirstCalled)
{

bRGB_LED_Enable();
bRGB_LED_Off();

bWhite_LED_Enable();
bWhite_LED_Off();

#if defined RGB || defined CCT
bRGB_LED_SetLevel(255,255,255);
bRGB_LED_SetGroupLevel( 255);
#else
bWhite_LED_SetLevel(255);
#endif
bFirstCalled = FALSE;
}
}

So UART1 TX can not work properly. I think these two lines should be controlled by the MACRO RGB:

#ifdef RGB
#info delete for UART1 TX
bRGB_LED_Enable();
bRGB_LED_Off();
#endif

if the UART1 TX is used in the mono light project.

 

That's all.

Tks!

This issue can be closed.

View solution in original post

0 Kudos
6 Replies
1,672 Views
YeelongWong
Contributor III

Hi,all


I found the root cause and sovled this problem.

 

Firstly, the official lib API vAHI_UartSetBaudRate with 115200 CAN NOT work well.
Because the UART clock is routed from 16MHz peripheral clock.
As it is said in JN-UG-3087, 115200 is just a approximant.
After my research, if you want to use 115200 you should use the code below:
/* SetBaudRate to 115200 */
vAHI_UartSetBaudDivisor(UART, 23);
vAHI_UartSetClocksPerBit(UART, 5);
instead of vAHI_UartSetBaudRate(UART, E_AHI_UART_RATE_115200)!!!
It seems that vAHI_UartSetBaudRate set BaudDivisor to 9! I think 23 is better and it is with my actual code.

In the same way, if you want to use 9600bps, please use:
/* SetBaudRate to 9600 */
vAHI_UartSetBaudDivisor(GSENSOR_UART, 119);
vAHI_UartSetClocksPerBit(GSENSOR_UART, 13);


Secondly, JN5169 can not undertake the huge data flood, so be careful if the other node outputs lots of data.
In my project, I decreased the datarate of the other device.

Thirdly, by the way, the UART1 TX pin is used in JN-AN-1189-ZigBee-HA-Demo\Common_Light\Source\DriverBulb\DriverBulb_DR1175.c.
in PUBLIC void DriverBulb_vInit(void):

PUBLIC void DriverBulb_vInit(void)
{
static bool_t bFirstCalled = TRUE;

if (bFirstCalled)
{

bRGB_LED_Enable();
bRGB_LED_Off();

bWhite_LED_Enable();
bWhite_LED_Off();

#if defined RGB || defined CCT
bRGB_LED_SetLevel(255,255,255);
bRGB_LED_SetGroupLevel( 255);
#else
bWhite_LED_SetLevel(255);
#endif
bFirstCalled = FALSE;
}
}

So UART1 TX can not work properly. I think these two lines should be controlled by the MACRO RGB:

#ifdef RGB
#info delete for UART1 TX
bRGB_LED_Enable();
bRGB_LED_Off();
#endif

if the UART1 TX is used in the mono light project.

 

That's all.

Tks!

This issue can be closed.

0 Kudos
1,738 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi @YeelongWong,

It seems that you exceed the bounties of your buffer. Are you sending a lot of UART data?

Could you please provide the files that you modified and the AN that you are using?

Regards,

Mario

0 Kudos
1,733 Views
YeelongWong
Contributor III

Hi,@mario_castaneda 

Tks for reply!

Yes, I connect a G-sensor to JN5169 UART 1.

The G-sensor will pour a lot of UART data to JN5169.

Above is the hardware.

The software is like this: 

The base code is JN-AN-1189-ZigBee-HA-Demo with JN-AN-1189-ZigBee-HA-Demo-1v15.pdf.

I add one timer-triggered task in the App_ZHA_Light_JN516x_mono.oscfgdiag.

And add code in JN-AN-1189-ZigBee-HA-Demo\Common_Light\Source\app_zcl_light_task.c

read gsensor.png

 init part and work part, but JN5169 resets:(

I think when data flood comes, the DMA will overflow and discard the data, why it will exceed the bounties of the buffer??

B.R.

Yeelong

 

0 Kudos
1,785 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi @YeelongWong,

I hope you are doing great.

A bus error exception is generated when software attempts to access a memory address that does not exist or is not populated with memory or peripheral registers.

How are you adding the UART1 module?

Please look at the next community post. Enabling UART1 on Coordinator on JN-AN-1217-Zigbee-3-0-Base-Device for JN5168

Regards,

Mario

0 Kudos
1,756 Views
YeelongWong
Contributor III

Hello, @mario_castaneda 

I have updated news:

I confirmed my code about reading from UART1, and I thought it was right, because when I used low speed data rate at 115200 bps, JN5169 UART1 could receive data and print out.

The key point is the other UART node, when the other node sends data with high  speed at 115200 bps, JN5169 will report "Bus error" or "AlignmentException" and then reset.

The JN5169 datasheet says the UART data speed supports 4Mbps.

But when I pour data via UART1, the JN5169 resets.

So if there bugs with UART 1 of JN5169?

 

Tks a lot!

0 Kudos
1,773 Views
YeelongWong
Contributor III

Hi, Mario

I init and use UART 1 like this:

YeelongWong_0-1604907627972.png

Then in the following code, I read the data with these two APIs:

 len = u16AHI_UartReadRxFifoLevel(1);
if(len > 0)
{
len = u16AHI_UartBlockReadData(1, &buf[0], sizeof(buf));

 

The bus error will not occurs every time, not 100%. So it is so strange.

 

I checked your reference link, it guides how to change the debug port from uart0 to uart1.

 

B.R.

Yeelong

 

0 Kudos