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.

    1. Have you tried debugging to see if your code might assert anywhere?
    2. Maybe you can try to read out the TWI registers, just to see if it is being configured the same way by both applications.
    3. You are doing a --chiperase when flashing your softdevice, and while it shouldn't be a big issue, I imagine it can cause some confusion if you forget about it and assume your application is still in place after flashing the softdevice.
    4. Maybe you can upload your code and then we can try to compile and debug it. It can be difficult though, if you have sensors etc. that we don't. You can upload the code in confidence on MyPage if your prefer that.
Reply
    1. Have you tried debugging to see if your code might assert anywhere?
    2. Maybe you can try to read out the TWI registers, just to see if it is being configured the same way by both applications.
    3. You are doing a --chiperase when flashing your softdevice, and while it shouldn't be a big issue, I imagine it can cause some confusion if you forget about it and assume your application is still in place after flashing the softdevice.
    4. Maybe you can upload your code and then we can try to compile and debug it. It can be difficult though, if you have sensors etc. that we don't. You can upload the code in confidence on MyPage if your prefer that.
Children
No Data
Related