This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2640R2F: Adding Legacy NPI to simpleCentral project

Part Number: CC2640R2F

Hello,

I've asked a few questions on here already about adding SPI to my projects and have not gotten anywhere.  I have realized however, that the project I am trying to re-develop (old devs left the company and code got lost) used Legacy NPI to communicate between a BLE module and an MSP430.  So I finally have realized I need to add Legacy NPI to my CC2640R2F simpleCentral project to maintain compatibility with the MSP430 as it is now.

What I am struggling with is actually figuring out how to implement this in my code.  All I've seen around this forum through my searching is that people recommend to base my project off of the host_test project, but I can't see how to do this.  There are several different files in the NPI folder that I know I need to include, and then I look through the files and there's all these initialization functions that need to be passed all sorts of arguments and there's callback functions for all sorts of events but I don't see how to actually use any of it.  I've spent weeks on this now and am going crazy trying so many different things.

I know I'll have to add the NPI_USE_SPI preprocessor definition, and I know I'll need some RX and TX buffers to hold incoming and outgoing data, but how do I take a RX buffer full of data and say "SendMyDataOnSPI()" so that it actually goes down the wires to the MSP430?  I once found an outdated wiki article explaining what lines of code to add to the application but this doesn't work anymore.

Any help is greatly appriciated.

  • Looking at host_test again, I've found that in my application I should open main.c and add

    #include "inc/npi_task.h"

    to the top and add

    NPITask_createTask(ICALL_SERVICE_CLASS_BLE);

    to the line right before BIOS_start() in order to begin the NPI task.  Past this I am still lost but will keep looking unless someone posts a reply.  Thanks

  • Hi Erik,

    I can't offer much detailed guidance until I have some time to look deeper into the legacy NPI implementation. However, here are some pointers to get started after briefly looking at host_test:

    1. Start by looking for all references to NPI in the application files.  The two files I would start looking in are from main.c and host_test_app.c
    2. Look at the surrounding code and how calls are made from the application to the NPI module. This will answer your question regarding how data is sent to SPI from the application. (e.g. check out NPITask_sendToHost and HostTestApp_sendToNPI)
    3. host_test is configured to send BLE messages to the application processor. If you are wanting to send your own custom data over NPI, you can look at the chain of function calls that eventually send data over the transport layer. In the case of host_test for example when sending TX messages, the high-level chain of function calls is NPITask_ProcessTXQ -> NPITL_writeTL -> transportWrite (NPITLSPI_writeTransport)
    4. Finally, I would suggest looking at all the NPI header files and look through the comments. This can give you a good idea of which API calls may be relevant for you to port/use in your application.

    Regards,
    Michael

  • Thanks for the reply, that's sort of what I have been doing but there's so many files and functions to look through with basically no idea what they all do makes it seem over my head right now.  Plus then the host_test uses function calls related to HCI stuff which seems like a whole different layer of code.  I see things that send a message to the TL and some that send messages to NPI or SPI and all these things have their own initializations and callbacks, it's too much without some sort of tutorial.

    I've now started the approach to just write bits straight to the SSI registers as outlined in the CC2640R2F reference manual because it seems like a more direct approach without all these layers of code on top that just obscure what actually happens underneath.

    If you or anyone else has any more info on this I would appreciate the help, thanks.  I'm surprised there isn't more questions on this to be honest, since it seems like having a BLE module communicate with another processor would be a common use case.