I should have explained this in a bit more detail before. Sorry about that.

The code is crashing on the nrf51 because it is attempting to initialize too 
many gpio irqs. The issue with the code is that it can support both FSK modes 
and lora modes. Two of those interrupts are not used for lora and you do not 
have to initialize them. A quick check to see if this fixes the issue would be 
to comment out the init of irq4 and irq5 in SX1276IoIrqInit():

#if 0
     rc = hal_gpio_irq_init(SX1276_DIO4, irqHandlers[4], NULL,
                           HAL_GPIO_TRIG_RISING, HAL_GPIO_PULL_NONE);
    assert(rc == 0);
    hal_gpio_irq_enable(SX1276_DIO4);



    rc = hal_gpio_irq_init(SX1276_DIO5, irqHandlers[5], NULL,
                           HAL_GPIO_TRIG_RISING, HAL_GPIO_PULL_NONE);
    assert(rc == 0);
    hal_gpio_irq_enable(SX1276_DIO5);
#endif

That should get you past the assert you see and get you to the next one :-)


> On Dec 8, 2017, at 4:29 AM, K Dmitry <[email protected]> wrote:
> 
> 
> 
> 01.12.2017, 20:34, "will sanfilippo" <[email protected]>:
>> Something does not quite make sense I have to say. Where it was crashing was 
>> in a very odd place; I can’t imagine different pins doing anything.
>> 
> I've tried to trace it again on nrf51 and here is what I got.
> 
> App gets to main() and crashes on sysinit(); call. Here is crash report:
> 
> 16848468 Assert @ 0x10fcf
> 16848468 Unhandled interrupt (2), exception sp 0x20001488
> 16848468  r0:0x00000000  r1:0x00000000  r2:0x80000000  r3:0xe000ed00
> 16848468  r4:0x00010fcf  r5:0x0001968c  r6:0xffffffff  r7:0x0000a6e9
> 16848468  r8:0xffffffff  r9:0xffffffff r10:0xffffffff r11:0xffffffff
> 16848468 r12:0xfffff7fe  lr:0x0000904f  pc:0x000081cc psr:0x81000200
> 16848468 ICSR:0x0041a002
> 
> I've traced it to assert() after DIO4 irq init in SX1276IoIrqInit  in 
> sx1276-board.c
> 
> Backtrace:
> 
> #0  __assert_func (file=file@entry=0x196e8 
> "repos/apache-mynewt-core/hw/drivers/lora/sx1276/src/sx1276-board.c", 
> line=line@entry=107, 
>    func=func@entry=0x0, e=e@entry=0x0) at 
> repos/apache-mynewt-core/kernel/os/src/arch/cortex_m0/os_fault.c:118
> #1  0x00010fce in SX1276IoIrqInit (irqHandlers=irqHandlers@entry=0x20000374 
> <DioIrq>)
>    at repos/apache-mynewt-core/hw/drivers/lora/sx1276/src/sx1276-board.c:107
> #2  0x00011a06 in SX1276Init (events=<optimized out>) at 
> repos/apache-mynewt-core/hw/drivers/lora/sx1276/src/sx1276.c:300
> #3  0x0000c6ec in LoRaMacInitialization 
> (primitives=primitives@entry=0x20003c68 <g_lora_primitives>, 
>    callbacks=callbacks@entry=0x200014f8 <os_main_stack+4060>) at 
> repos/apache-mynewt-core/net/lora/node/src/mac/LoRaMac.c:3518
> #4  0x0000b2d4 in lora_node_init () at 
> repos/apache-mynewt-core/net/lora/node/src/lora_node.c:680
> #5  0x00010c12 in sysinit_app () at 
> bin/targets/nrf51lora_app/generated/src/nrf51lora_app-sysinit-app.c:43
> #6  0x000084e6 in main () at 
> repos/apache-mynewt-core/apps/lora_app_shell/src/main.c:133
> 

Reply via email to