This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Issue running TWI/SPI on nRF52832, works with Kiel but not GCC

Hi,

Just curious to know if anyone else had this issue and how they solved it.

My colleagues and I are working on code based on the Nordic Uart Service, in SDK13.1.0 with SD132v4.0.2 on an nRF52832 chip. For better context, colleagues develop using Kiel on Windows, where as I am developing on a Mac (NetBeans + GCC setup, GNU_VERSION = 6.3.1).

Our test project interfaces with sensors via TWI and SPI and sends data over BLE. When programmed through kiel, the device works fine (i.e. can set up interfaces, collect data, connect and send data etc.).

The same project when downloaded into my environment, can compile, build and flash code just fine. Except the following:

  • TWI init() works fine.
  • on attempting to initialize the first sensor and writing to it over TWI, the twi handler never gets called, and hence hangs. (e.g. nrf_drv_twi_tx() returns NRF_SUCCESS)

Similar behavior is also seen with the SPI.

I know my development environment works fine when I have to program a PCA10040 dev kit, with code from the example projects for testing. I also have a pretty good understanding of setting up the Makefile and adjusting the RAM allocations through the .ld file. sdk_config.h also has the necessary flags enabled for running the interfaces (else they wouldn't work when programmed through Kiel either). I am confused as to why a project would compile and run fine through Kiel, but will not run the same through GCC.

I have also tried flashing the twi_scanner project to a devkit, without the soft device, which works fine too.

I am guessing that I may be missing something else in my development setup, but it just does not seem obvious to me. I would be glad if some one has found the solution to this before!

Thanks, Jai

Parents
  • There are a few bugs in the .ld for GCC. The new stuffs with Section after the FLASH & RAM setting. Look for > RAM and replace it with '> RAM AT > FLASH'. This affects project using Softdevice. That was one of the problem I found since SDK12.

  • Hi @Martin, Here's what I have tried with regards to your suggestions:

    1. I have mostly been debugging using the logger and LEDs. From this I have observed that after calling nrf_drv_twi_tx(), the code is stuck waiting for the callback handler to return (blocking call).
    2. Since all my calls with TWI hang, I can't seem to do anything. The same project and code works fine via Kiel though.
    3. For each build and run, I follow the --chiperase with flashing soft device and app, so it shouldn't pose a problem. Can compile example projects for DK, but not our custom board..
    4. I will consider this as my last resort if I cannot seem to get it to work in any way on my end.

    As @Nguyen suggested, I am looking to set up Segger Embedded Studio, which has explicit instructions for setting flash placement. I suspect this part is missing from my current Netbeans setup.

Reply
  • Hi @Martin, Here's what I have tried with regards to your suggestions:

    1. I have mostly been debugging using the logger and LEDs. From this I have observed that after calling nrf_drv_twi_tx(), the code is stuck waiting for the callback handler to return (blocking call).
    2. Since all my calls with TWI hang, I can't seem to do anything. The same project and code works fine via Kiel though.
    3. For each build and run, I follow the --chiperase with flashing soft device and app, so it shouldn't pose a problem. Can compile example projects for DK, but not our custom board..
    4. I will consider this as my last resort if I cannot seem to get it to work in any way on my end.

    As @Nguyen suggested, I am looking to set up Segger Embedded Studio, which has explicit instructions for setting flash placement. I suspect this part is missing from my current Netbeans setup.

Children
No Data
Related