Thread Host Controlled Device over SPI instead of UART

cancel
Showing results for 
Search instead for 
Did you mean: 

Thread Host Controlled Device over SPI instead of UART

Jump to solution
630 Views
jc_pacheco
NXP Employee
NXP Employee

From: alexwheeler

Any help would be appreciated getting SPI interface working.  

I found the following in the code:

 

/* SPI Slave Data Available Pin */

#define gSpiSlaveDap_Port_d   gpioPort_B_c

#define gSpiSlaveDap_Pin_d    1

 

So i'm guessing there is another connection I need to make from the FRDM-KW41Z to the GPIO on the RPI for the DAP signal?  Which pin would this be on the FRDM-KW41Z?

 

Thanks

Labels (2)
Tags (4)
0 Kudos
1 Solution
198 Views
jc_pacheco
NXP Employee
NXP Employee

Hi Alex,

Some information available here: MKW41z connectivity software THCI interface over SPI  

As mentioned in the other thread, when enabling THCI over SPI you must take into account:

  • Disable any other THCI configured interface
#define THCI_UART_ENABLE 0

  • Select THCI over SPI interface
#define THCI_SPI_ENABLE  1

  • Configure HCD SPI as master or slave
    See ".interfaceType" at 'static const gFsciSerialConfig_t mFsciSerials[]' at app_init.c

  • Configure interface channel
    See ".interfaceChannel" at 'static const gFsciSerialConfig_t mFsciSerials[]' at app_init.c

  • Configure GPIO pin name depending on the "Data Available" pin that you'll be using.
    Master or Slave, this depends on your setup. See gpio_pins.h
/* SPI Master Data Available Pin */
#define gSpiMasterDap_Port_d  gpioPort_B_c
#define gSpiMasterDap_Pin_d   1

/* SPI Slave Data Available Pin */
#define gSpiSlaveDap_Port_d   gpioPort_B_c
#define gSpiSlaveDap_Pin_d    1‍‍

Hope this helps.

Regards,

JC

View solution in original post

0 Kudos
5 Replies
199 Views
jc_pacheco
NXP Employee
NXP Employee

Hi Alex,

Some information available here: MKW41z connectivity software THCI interface over SPI  

As mentioned in the other thread, when enabling THCI over SPI you must take into account:

  • Disable any other THCI configured interface
#define THCI_UART_ENABLE 0

  • Select THCI over SPI interface
#define THCI_SPI_ENABLE  1

  • Configure HCD SPI as master or slave
    See ".interfaceType" at 'static const gFsciSerialConfig_t mFsciSerials[]' at app_init.c

  • Configure interface channel
    See ".interfaceChannel" at 'static const gFsciSerialConfig_t mFsciSerials[]' at app_init.c

  • Configure GPIO pin name depending on the "Data Available" pin that you'll be using.
    Master or Slave, this depends on your setup. See gpio_pins.h
/* SPI Master Data Available Pin */
#define gSpiMasterDap_Port_d  gpioPort_B_c
#define gSpiMasterDap_Pin_d   1

/* SPI Slave Data Available Pin */
#define gSpiSlaveDap_Port_d   gpioPort_B_c
#define gSpiSlaveDap_Pin_d    1‍‍

Hope this helps.

Regards,

JC

View solution in original post

0 Kudos
198 Views
alexwheeler
Contributor I

Hi Juan,

 

I'm really happy to have your help, I see in other threads you always find the solution.  Things are now 50% working (TX).  I'm also receiving data, however I think my DAP side of things isn't working yet on the RPI linux side.

 

My previous issue were the following:

I setup ".interfaceType" at 'static const gFsciSerialConfig_t mFsciSerials[]' at app_init.c - to be Slave (It was Master).

I Setup ".interfaceChannel" at 'static const gFsciSerialConfig_t mFsciSerials[]' at app_init.c - to be 0, it was 1.

 

------

 So now at-least, when running getaddr, I can see the led goes to green which means my network is setup.  I also see RX data dumped on the screen.  However when i'm running that command I receive many "No response for the previous command".

 

It must be I don't have the uio dev setup correctly in the dts file, so the /dev/uio0 is not functioning how it should be.

Do you have any examples I could follow?  Maybe you have a dts file I could see for iMX6?  I'm trying to make this for RPI3. 

  

Thanks in advance

Alex

0 Kudos
198 Views
jc_pacheco
NXP Employee
NXP Employee

Hi Alex,

There's a KW41Z maintenance release upcoming early Q1 2018. It will include a THCI over SPI example using the KW41Z with a DK07 AP as host.

-JC

0 Kudos
198 Views
alexwheeler
Contributor I

Hi JC,

That's great news, but still I will forge forwards to get this working on my setup using a RPI.  Actually i'm 80% there now.  When I run getaddr, it now does a factory reset, I get information about the board back.  It doesn't say no response for this section now.  And it creates a new network.  It also does not say no response for that.  However when it does the next step of ifconfig_all, I see a whole bunch of RX, but it fails there and says no response.

Does this still sound like an issue with the config of the DAP pin in Linux?  I configured it as a pull down (input) and make interrupt on RISING_EDGE.  Is that a correct assumption?  Is DAP high when data is available?

Thanks

Alex

0 Kudos
198 Views
jc_pacheco
NXP Employee
NXP Employee

Hi Alex,

I'm glad to see you are progressing with your development.

The data available pin transition type when slave has data to transmit is defined by gSerialMgrSlaveDapTxLogicOne_c.

It's currently configured at source/config.h

#if THCI_SPI_ENABLE
    #define gSerialMgrRxBufSize_c               (768)  /* required for large ICMP ECHO_REQUESTs (e.g. 1200) */
    #define gSerialMgrUseUart_c                 (0)
    #define gSerialMgrUseSPI_c                  (1)
    #define gSerialMgrUseFSCIHdr_c              (1)
    #define gSerialMgrSlaveDapTxLogicOne_c      (0)    //<-------
    #define gFsciTxAck_c                        (0)
    #define gFsciRxAck_c                        (0)
    #define gNvPendingSavesQueueSize_c          (64)
#endif

- JC

0 Kudos