Actually, TIMER_3 is not the correct timer to use. The lora code currently does 
not use the RTC timer so you need a different timer to run lora. I would use 
TIMER_2 to do this for the nrf51.

I also presume that you found the definitions for the various GPIO that connect 
the sx1276 to the main cpu. These are currently defined in bsp.h in 
hw/bsp/telee02. The SPI pin definitions are in mixed places:
* The SPI CS pin is in syscfg.yml.
* The SCK, MOSI and MISO definitions are in hal_bsp.c in static const struct 
nrf52_hal_spi_cfg os_bsp_spi0m_cfg 

A case could be made to have all of these definitions as configurable MYNEWT 
variables in the lora driver itself and then have them overridden by a custom 
bsp or in the target but for now you will either have to create your own bsp 
and make these modifications or locally modify your nrf51dk bsp.

Lastly: did you build and load the bootloader on this device? I see that you 
have a bootloader target but I did not see in the list of commands if you built 
and loaded it.

Thanks

> On Nov 29, 2017, at 10:32 AM, marko kiiskila <[email protected]> wrote:
> 
> I don’t think the system is even booting properly.
> If you run it under debugger, can you verify that you’re not reaching main()?
> 
> Here’s few things that you should look at:
> TIMER_4 does not exist with the BSP you’re using.
> So you could try adjusting LORA_MAC_TIMER_NUM to 3,
> and saying TIMER_3=1, instead of TIMER_4.
> Look for the hal timers for this BSP in hw/bsp/nrf51dk/syscfg.yml
> 
>> On Nov 29, 2017, at 9:02 AM, K Dmitry <[email protected]> wrote:
>> 
>> 
>> I've connected SX1276 with some wires but not sure if connection is good. 
>> Also I've added debug info:
>> 
>> $ newt target show
>> targets/nrf51lora_app
>>   app=@apache-mynewt-core/apps/lora_app_shell
>>   bsp=@apache-mynewt-core/hw/bsp/nrf51dk
>>   build_profile=debug
>>  
>> syscfg=BASELIBC_ASSERT_FILE_LINE=1:LORA_MAC_TIMER_NUM=4:SHELL_CMD_ARGC_MAX=20:SYSINIT_PANIC_FILE_LINE=1:SYSINIT_PANIC_MESSAGE=1:TIMER_4=1
>> targets/nrf51lora_boot
>>   app=@apache-mynewt-core/apps/boot
>>   bsp=@apache-mynewt-core/hw/bsp/nrf51dk
>>   build_profile=optimized
>> 
>> Then build image:
>> 
>> $ newt clean nrf51lora_app
>> $ newt build nrf51lora_app
>> $ newt create-image nrf51lora_app 0.0.1
>> $ newt load nrf51lora_app
>> 
>> Nothing has changed in UART:
>> 
>> 000000 ICSR:0x00421002
>> 000000 Assert @ 0x10e0d
>> 000000 Unhandled interrupt (2), exception sp 0x200013d0
>> 000000  r0:0x00000000  r1:0x00000000  r2:0x80000000  r3:0xe000ed00
>> 000000  r4:0x00010e0d  r5:0x00000044  r6:0x00000008  r7:0x20002820
>> 000000  r8:0xffffffff  r9:0xffffffff r10:0xffffffff r11:0xffffffff
>> 000000 r12:0xfffff7fe  lr:0x0000906b  pc:0x000081cc psr:0x81000200
>> 
>> Using gdb I got to these lines:
>> os_arch_os_init () at 
>> repos/apache-mynewt-core/kernel/os/src/arch/cortex_m0/os_arch_arm.c:195
>> 190      os_error_t err;
>> 191      int i;
>> 192  
>> 193      /* Cannot be called within an ISR */
>> 194      err = OS_ERR_IN_ISR;
>> 195      if (__get_IPSR() == 0) {
>> 196          err = OS_OK;
>> 
>> And a bit later:
>> 
>> os_init (main_fn=0x84dd <main>) at 
>> repos/apache-mynewt-core/kernel/os/src/os.c:186
>> 186      assert(err == OS_OK);
>> (gdb) p err
>> $5 = OS_ERR_IN_ISR
>> 
>> Not sure if this it cause or consequence.
> 

Reply via email to