JN-AN-1218 build problems

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

JN-AN-1218 build problems

3,367 Views
youpko
Contributor II

I success fully compiled the JN-AN-1218 with the following configuration

make LIGHT=DimmableLight JENNIC_CHIP_FAMILY=JN516x JENNIC_CHIP=JN5168 DR=DR1175 TRACE=1 GP_SUPPORT=0 GP_DEVICE=COMBO_BASIC OTA=0 TOUCHLINK=1

But I want to implement my own DriverBulb interface, so i started with the DriverBulb_JN516X.c as a reference. Tried compiling that with:

make LIGHT=DimmableLight JENNIC_CHIP_FAMILY=JN516x JENNIC_CHIP=JN5168 DR=JN516X TRACE=1 GP_SUPPORT=0 GP_DEVICE=COMBO_BASIC OTA=0 TOUCHLINK=1

But that wont compile The linker gives an error:

../../DimmableLight/Build/irq_JN516x.o:(.text+0x4c): undefined reference to `vISR_SystemController'

But as far as I can tell the DriverBulb_JN516X.c has no correlation with "vISR_SystemController"

So commened out the folowing lines in "irq_JN516x.s" and left everyting else as how it was.

.globl  PIC_SwVectTable
    #.extern vISR_SystemController
PIC_SwVectTable:
    #.word vISR_SystemController             # 15

Compiled it with the same command as above. and that completes without any errors.

So the next step was to program the "DimmableLight_JN5168_JN516X.bin" into the JN5168-001-M00 module.

But i get the following in the serial output.

***********************************************
* LIGHT NODE RESET                            *
***********************************************
APP: Entering APP_vInitResources()
APP: Initialising resources...
APP_vInitialiseNode
eStatusReportReload = 0

Zll recovered state 00

 eCLD_ScenesCreateScenes: eCLD_ScenesCountScenes() u8SceneCount = 1MAKE Reportable ep 1
Cluster 0006 Attribute 0000 Min 1 Max 61 IntV 0 Direct 0 Change 0
Cluster 0008 Attribute 0000 Min 1 Max 61 IntV 0 Direct 0 Change 10

Set a random pan

Factory new start up
PDM: Capacity 29
PDM: Occupancy 34
APP: Entering BDB_vStart()
BDB: Disc on Ch 11 from 0x02108800
APP: Entering APP_vMainLoop()
BDB: APP_vGenCallback [0 10]
BDB: Disc on Ch 15 from 0x02108800
BDB: ZCL Event 6
BDB: APP_vGenCallback [0 10]
BDB: vNsTryNwkJoin - index 0 of 0 Nwks
BDB: No suitable network! Continue Discovery
BDB: Disc on Ch 20 from 0x02108800
BDB: ZCL Event 6
BDB: APP_vGenCallback [0 10]
BDB: Disc on Ch 25 from 0x02108800
BDB: ZCL Event 6
BDB: APP_vGenCallback [0 10]
BDB: Disc on Ch 12 from 0x05ef7000
BDB: ZCL Event 6
BDB: APP_vGenCallback [0 10]
BDB: Disc on Ch 13 from 0x05ef7000
BDB: ZCL Event 6
BDB: APP_vGenCallback [0 10]
BDB: Disc on Ch 14 from 0x05ef7000
BDB: ZCL Event 6

!!! Bus error
u32PICMR = 0 : u32PICSR = 8008
u32PICMSR = 0 : u32IPMR = 0
u32IHPR = c : u32AINT = 8008 u32PINT 0
EPCR = ad444 : EEAR = 2001f00
Stack dump:
 4007f58 : 00000002
 4007f5c : 00083237
 4007f60 : 00000006
 4007f64 : 000ad444
 4007f68 : 02001f00
 4007f6c : 00000000
 4007f70 : 0000000c
 4007f74 : 00000000
 4007f78 : 00008008
 4007f7c : 00000000
 4007f80 : 00000000
 4007f84 : 00008008
 4007f88 : 0000005a
 4007f8c : 000832a2
 4007f90 : 00000006
 4007f94 : 0008488a
 4007f98 : 00000002
 4007f9c : 00084589
 4007fa0 : 00000000
 4007fa4 : 00000000
 4007fa8 : 00000000
 4007fac : 00000000
 4007fb0 : 00000000
 4007fb4 : 00000000
 4007fb8 : 00000000
 4007fbc : 00000000
 4007fc0 : 00000000
 4007fc4 : 00000000
 4007fc8 : 00000000
 4007fcc : 00000000
 4007fd0 : 00000000
 4007fd4 : 000854ce
 4007fd8 : 00000000
 4007fdc : 00000003
 4007fe0 : 00000002
 4007fe4 : 00083387
 4007fe8 : 00000002
 4007fec : 00000a5b
 4007ff0 : 00000000
 4007ff4 : 00000000
 4007ff8 : 00091d35
 4007ffc : 76543210

So that stack dump clearly indicates that commeting out those lines was not the correct way to fix this.

I also tried to just stub out "vISR_SystemController" in the source file. (just implement the function but with no code in the body)

but that still gives the !!! Bus error stack dump.

How should I proceed to adapt the example code to my application?

0 Kudos
34 Replies

2,077 Views
jacco_bezemer
Contributor III

Hi Youp or Mario,

Was this issue ever solved. I'm asking because i experience the exact same problem.

I came to the conclusion that JN-AN-1218 doesn't work with the DriverBulb_JN516X.c example.

At first a lot of changes have to be made to the source before it builds and when that finally succeeds the JN5169 crashes with a bus error and a stack dump.

Is there a working example that results in a dimmable light without buttons etc? 

Kind regards,

Jacco

0 Kudos

2,077 Views
jacco_bezemer
Contributor III

So, I did some trial and error and found out that the call to APP_vManageTemperatureTick in app_zcl_light_task.c causes the bus error.

This is because vAHI_ApConfigure is never called in app_manage_temperature.c\APP_vManageTemperatureInit due to incorrect compiler directives. By removing the compiler directives or correcting the directives no bus error occurs and everything works as expected.

2,077 Views
youpko
Contributor II

I think it has something do with that the interupt system. But I cant find any information on how the irq_JN516x.S works.

the assembly lines you changed where:

#.byte 15                # system controller priority

...

#.extern vISR_SystemController

...

#.word vISR_SystemController         # 15
  .word vUnclaimedInterrupt               # 15

I now that the Interrupt controller has 16 priorities, so would be commeting out the first line not invalidate the list as it now only 15 items long?

So I tried the following:

#.byte 15                # system controller priority

.byte 0

And that gave me the following output:

...

Set a random pan
BDB: Disc on Ch 11 from 0x02108800
BDB: APP_vGenCallback [0 10]
BDB: Disc on Ch 15 from 0x02108800
BDB: ZCL Event 6
BDB: APP_vGenCallback [0 10]
BDB: vNsTryNwkJoin - index 0 of 0 Nwks
BDB: No suitable network! Continue Discovery
BDB: Disc on Ch 20 from 0x02108800
BDB: ZCL Event 6
BDB: APP_vGenCallback [0 10]
BDB: Disc on Ch 25 from 0x02108800
BDB: ZCL Event 6
BDB: APP_vGenCallback [0 10]
BDB: Disc on Ch 12 from 0x05ef7000
BDB: ZCL Event 6
BDB: APP_vGenCallback [0 10]
BDB: Disc on Ch 13 from 0x05ef7000
BDB: ZCL Event 6
BDB: APP_vGenCallback [0 10]
BDB: Disc on Ch 14 from 0x05ef7000
BDB: ZCL Event 6

!!! Bus error
u32PICMR = 0 : u32PICSR = 8008
u32PICMSR = 0 : u32IPMR = 0
u32IHPR = c : u32AINT = 8008 u32PINT 0
EPCR = bb5b0 : EEAR = 2001f00
Stack dump:

...

As you can see the network scan is preformed as expected but the bus error is back again.

So this lets me to believe that the stack/application is all running properly but the processor is somewhere stuck on an interrupt.

I have no clue if that assumption correct.

But maybe this helps investigate the issue further.

0 Kudos

2,077 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Youp,

You are getting the bus error because you set up system controller priority so, the JN516X is not setting up any button, and the system controller depends on that.

You are not seeing the terminal print because the event is not equal to TRUE.

if (ZQ_bQueueReceive(&APP_msgAppEvents, &sAppEvent) == TRUE)
{


DBG_vPrintf(TRACE_APP, "ZPR: App event %d, NodeState=%d\n", sAppEvent.eType, sZllState.eNodeState);

If you look into the app_events.h,

You will see the events types that are defined.

typedef enum
{
    APP_E_EVENT_NONE = 0,
    APP_E_EVENT_BUTTON_UP,
    APP_E_EVENT_BUTTON_DOWN,
    APP_E_EVENT_LEAVE_AND_RESET,
    APP_EVENT_POR_FIND_BIND,
    APP_EVENT_POR_CLEAR_BINDINGS,
    APP_EVENT_POR_RESET_GP_TABLES,

    APP_E_EVENT_MAX
} APP_teEventType;

the events are set only for the buttons.

typedef struct
{
    APP_teEventType eType;
    union
    {
        APP_tsEventButton                   sButton;
    }uEvent;
} APP_tsLightEvent;

You need to create a simple routing that changes that waits for the events for a timer, UART, SPI, not for buttons that are not included.

Regards,

Mario

0 Kudos

2,077 Views
youpko
Contributor II

Hi Mario,

I just wondered because removeing that priority line from the assembly shifts all the other priorities one up.

I am I correct that every line corresponds with one prioirty for one specific module?
If i have that correct that would mean removing one line doesn't disable the System Controller Priority but instead set it to 7?

The MAC(7) priority is at byte 4, but because we remove byte 3 SystemController = 7 and MAC = 0, and The Tick timer priority is not set all because we remove line 3.

PIC_ChannelPriorities:
    .byte 0                 # pwm1 priority
    .byte 0                 # pwm2 priority
    #.byte 15                # system controller priority
    .byte 7                 # MAC priority
    .byte 0                 # AES priority
    .byte 0                 # PHY priority
    .byte 0                 # uart0 priority
    .byte 0                 # uart1 priority
    .byte 0                 # timer0 priority
    .byte 0                 # spi slave priority
    .byte 0                 # i2c maste/slave priority
    .byte 0                 # spi master priority
    .byte 13                # pwm4 priority
    .byte 0                 # analog peripherals priority
    .byte 14                # pwm3 priority
    .byte 12                # tick timer priority

About the Debug output why should i see that?

Building for DR1175 I dont see that unlesh i press a button. But I don't need that because at startup the network steering is preformed. I never used any button to connect to the network.

That part with the button is dead code because it can never becalled due to that the app_buttons.c is not compiled. But that doens't explain why the netwerk steering is not progressed after one channel.

0 Kudos

2,077 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Youp,

I am I correct that every line corresponds with one priority for one specific module?

Yes, is the priority

You do not need the buttons, but must of the application depends on the system controller. 

Please look at all the events that are calling the buttons. That is the reason why are you getting the bus error.

Regards,

Mario

0 Kudos

2,082 Views
youpko
Contributor II

Hi Mario,

No problem English is not my main language so I don't expect my messages are put together all that well.

Yes that is what i want to achieve. But even without creating a custom driverbulb implementation and just using the provided DriverBulb_JN156X.c example I just cant get it to work.

My process:

  1. download the JN-AN-1218
  2. Import it in to BeyondStudio
  3. Edit Makefile
    • JENNIC_CHIP=JN5168
    • DR=JN516X
  4. Compile Error: DimmableLight/Build/irq_JN516x.o:(.text+0x4c): undefined reference to `vISR_SystemController

After looking through the other DriverBulb examples if found that some just define the function but with no actual code.

  • Implement the vISR_SystemController() {}
  • Compile Succes
  • Program the JN5168 module
  • Run: Bus Error

I aslo tried:

  1. download the JN-AN-1218
  2. Import it in to BeyondStudio
  3. Edit Makefile
    • JENNIC_CHIP=JN5168
    • DR=WS2812
  4. Compile Error: gave a hole list of compile errors. but did not further  investigate that because I have no plans on using WS2812 LEDs
0 Kudos

2,082 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Youp,

Why are you define DR=JN516x? 

The DR is referring to the expansion board that you are working on. For example DR1175

DR ?= DR1175
ifeq ($(DR), DR1175)
CFLAGS  += -DBUTTON_MAP_DR1175
endif

It will enable the DIO that the DR is using. 

Please look at the JN-RD-6038

Describes low-cost designs for modules based around the JN516x wireless microcontrollers.

Also, if you do not define the DR, the JN could enter in a bus error state, or you won't see the PWM output, in this case.

Please look at the https://community.nxp.com/thread/480152

Regards,

Mario

0 Kudos

2,082 Views
youpko
Contributor II

Hi Mario,

After going trough the JN-AN-1218 it seemed that defining DR=JN516x was the way to build the DriverBulb_JN516x.c

Because changing the DR define you can select different Evaluation Kits so I assumed that setting DR=JN516X in there it would build the image for a bare JN5168/JN5169 module.

I guess I assumed wrong?

I read through JN-RD-6038 but that described how to make your own modules based on the JN516x chips, but that is not for my application as I using the JN5168-001-M00 module.

I also read though the thread you linked. I did what you described there to make my configuration for the JN5168.

0 Kudos

2,082 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Youp,

The Chip Family is the one that is defining the JN516x ports.

ifeq ($(JENNIC_CHIP_FAMILY), JN516x)
APPSRC += irq_JN516x.S
APPSRC += portasm_JN516x.S
APPSRC += port_JN516x.c
endif

Regards,

Mario

0 Kudos

2,082 Views
youpko
Contributor II

Hi Mario,

I see in the compile log that those files are indeed used.
But those files needs to be compiled regardless of if you want to build the DR=1175 or the DriverBulb_JN516x.c

As they are the code to setup the chip and configure the interrupts right?

Because I still haven't figured out how to build just the DriverBulb_JN516x.c and not the demo board DR1175 example.

Because if you don't specify the DR in the make command than it defaults to DR1175.
That is why I thought to do "make ... DR=JN516x ..." because than the make file will skip all the DR1175 related code and compiles the DriverBulb_JN516x.c.

But that gives the bus error when you run it on the JN5168 module.

So my problem has to be one of the following:

  1. So my method to building the DriverBulb_JN516x.c is wrong
  2. I forgot to implement something,
  3. Maybe the DriverBulb_JN516x.c is not complete.

I wanted to compile the DriverBulb_JN516x.c example because that setups a PWM output, and that is nice an easy entry point to write my own implementation.

0 Kudos

2,082 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Youp,

I had been running some test.

You could compile with the DriverBulb_JN516X.c

Please see the steps below.

Set the JN516X in the build properties

pastedImage_1.png

In the Makefile

#DR = DR1175
DR = JN516X

The file DriverBulb_JN516X.c

Comment the next line, because you do not have a config.h file or you can add the configurations that you need and add the next code as below.

/* Application includes */
//#include "Config.h"‍‍
.
.
.
 ****************************************************************************/
PUBLIC void DriverBulb_vOn(void)
{
 /* Lamp is not on ? */
 if (bIsOn != TRUE)
 {
  /* Note light is on */
  //bIsOn = TRUE;
  DriverBulb_vSetOnOff(TRUE);
  /* Set outputs */
  DriverBulb_vOutput();
 }
}
PUBLIC void DriverBulb_vSetOnOff(bool_t bOn)
{
 bIsOn =  bOn;
    DBG_vPrintf(TRUE, "\nS:%s",(bOn ? "ON" : "OFF"));
}

Open the irq_JN516x.S file and comment the system controller defines.

PIC_ChannelPriorities:   
    #.byte 15                # system controller priority
.
.
.
.globl  PIC_SwVectTable
    #.extern vISR_SystemController
.
.
.
PIC_SwVectTable:
    .word vUnclaimedInterrupt               # 15
    #.word vISR_SystemController             # 15

I ran by my side and it works. it does not enter the bus error.

Please let me know your findings.

Regards,

Mario

2,080 Views
youpko
Contributor II

Hi Mario,

That seems to do the trick.

But I cant find the row in the makefile. Did you mean:

#DR ?= DR1175
DR ?= JN516X

But without the change to the makefile it already works no more bus error.

But that showed the next problem.

It doesn't loop the channels when scanning for a network anymore.

With DR1175 it used to loop all the channels set in the configuration, but now it only scans on channel 11.

But I didn't change the configuration.

But thanks a lot for helping me with this Mario,

0 Kudos

2,077 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Youp,

Please look at the bdb_options.h, or you can set only one channel if you want in the makefile.

Regards,

Mario

0 Kudos

2,077 Views
youpko
Contributor II

Hi Mario,

I had a look into it but nowhere is single channel defined. If that is defined it should give a warning while compiling (#warning in bdb_options.h) but that is not happening.

And I changed nothing else expect the change that you gave me to compile the DriverBulb_JN516X.c.
And it used to work before you helped me compile the DriverBulb_JN516X.c

This is the only output i get now:

Factory new start up

PDM: Capacity 35
PDM: Occupancy 28
APP: Entering BDB_vStart()
BDB: 0x02108800 0x00000800 11, [11-26]
BDB: Disc on Ch 11 from 0x02108800
APP: Entering APP_vMainLoop()

And before it was something like this:

Factory new start up
PDM: Capacity 29
PDM: Occupancy 34
APP: Entering BDB_vStart()
BDB: Disc on Ch 11 from 0x02108800
APP: Entering APP_vMainLoop()
BDB: APP_vGenCallback [0 10]
BDB: Disc on Ch 15 from 0x02108800
BDB: ZCL Event 6
BDB: APP_vGenCallback [0 10]
BDB: vNsTryNwkJoin - index 0 of 0 Nwks
BDB: No suitable network! Continue Discovery
BDB: Disc on Ch 20 from 0x02108800
BDB: ZCL Event 6
BDB: APP_vGenCallback [0 10]
BDB: Disc on Ch 25 from 0x02108800
BDB: ZCL Event 6
BDB: APP_vGenCallback [0 10]
BDB: Disc on Ch 12 from 0x05ef7000
BDB: ZCL Event 6
BDB: APP_vGenCallback [0 10]
BDB: Disc on Ch 13 from 0x05ef7000
BDB: ZCL Event 6
BDB: APP_vGenCallback [0 10]
BDB: Disc on Ch 14 from 0x05ef7000
BDB: ZCL Event 6

0 Kudos

2,077 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Youp,

You could set the single channel in the makefile.

If the device is set only in one channel, The device will show a discovery network if the device finds a network.

Regards,

Mario

0 Kudos

2,077 Views
youpko
Contributor II

Hi Mario,

That is the point I didn't set that, and I want multi channel.

But building with JN516X.c break the channel scan.
the APP_vGenCallback doesn't seem to be called any more.

0 Kudos

2,077 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Youp,

Did you define the CFLAGS += -DDEBUG_BDB in the make file?

Regards,

Mario

0 Kudos

2,077 Views
youpko
Contributor II

Hi Mario,

Yes that is still defined as it was before.

The things changed where your recommendation on how to build DriverBulb_JN516X.c

The JN worked as expected before building for DriverBulb_JN516X.c

0 Kudos

2,077 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Youp,

You comment the system controller, and the JN-AN-1218 is calling the APP_taskLight.c, but the switch case is waiting for an event. In this case, is waiting for the button press.

You must change the code.

case APP_E_BUTTONS_BUTTON_2:
if (sZllState.eNodeState == E_RUNNING)
{
.
.
.
  BDB_eNsStartNwkSteering();
.
.

Regards,

Mario

0 Kudos