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.

Linux/CC2530: CC2530 : Serial interfacing with host processor using SPI

Part Number: CC2530
Other Parts Discussed in Thread: Z-STACK

Tool/software: Linux

Hi,

   I am working on  Z-stack linux gateway application and CC2530F256 with Z-stack Home automation profile on an IMX6 based custom board. Since all UARTs are preoccupied in our board we need to use SPI interface for connecting CC2530 with the host processor.

I compiled ZNP image with macros CC2530_MK and HAL_SPI=true in compiler options for IAR.

On Z-stack linux gateway application side I have made the following changes in the NPI_Gateway.cfg:

[PORT]

port=2533

[DEVICE]

#deviceKey=0 ; UART

deviceKey=1 ; SPI

#devPath="/dev/ttymxc2" ; UART/CDC

devPath="/dev/spidev1.0" ; UART

[GPIO_SRDY.GPIO]

value="/sys/class/gpio/gpio124/value"

direction="/sys/class/gpio/gpio124/direction"

active_high_low=1 ; (Active Low=0, Active High=1)

[GPIO_MRDY.GPIO]

value="/sys/class/gpio/gpio134/value"

direction="/sys/class/gpio/gpio134/direction"

active_high_low=1 ; (Active Low=0, Active High=1)

[UART]

speed=115200 ; speed

flowcontrol=0 ; 1=enabled 0=disable

[SPI]

speed=500000 ; Set default speed 500kHz

[LOG]

log="./NpiLnxLog.txt" ; file to log all event/error

In the IMX6 device tree two pins are configured as GPIO for SRDY & MRDY.

For interfacing with SPI, I used the generic SPI drivers with device entry as /dev/spidev1.0. The SPI interface is validated using oscilloscope and it is working fine.

The current pin configurations of CC2530 for SPI mode are :

    P0_4 -> SSN

    P0_5 -> SCK

    P0_3 -> MOSI

    P0_2 -> MISO

    P1_4 -> MRDY

    P1_5 -> SRDY

With the above changes on running the script zigbeeHAgw error happens and get restarted.

The following is the log for the error :

./zigbeeHAgw bbb

running zigbeegw.scr on an ARM

skipping zigbee reset

Starting the ZigBee gateway subsystem

deviceKey = 1  (1 )

devPath = '/dev/spidev1.0'

logPath = './NpiLnxLog.txt'

[CONFIG] ERROR , key 'edge' is missing for mandatory GPIO GPIO_SRDY.GPIO

... freeing memory (ret -1)

Could not open device... exiting

NPI started (pid 801) at Thu May  4 14:03:51 UTC 2017

connect: Connection refused

[ZSTACKZNP_SRVR/MAIN] FATAL: appMain> Connection to NPI server failed. Exiting...

Since the SPI interface is up and working, I think there are some changes needed to be made related with Z-Stack / CC2530.

I have the following queries regarding the above configurations :

1. Is there any other compiler option changes or file inclusions required for SPI in the ZNP firmware side?

2. I would also like to know if any other changes are required on Z-stack linux gateway application side ?

3. In NPIGateway.cfg the pins GPIO_SRDY.GPIO & GPIO_MRDY.GPIO are configured as GPIO in IMX6 dts & is connected to CC2530 as

    P1_4 -> MRDY

    P1_5 -> SRDY

    What about the pins  GPIO_SRDY.LEVEL_SHIFTER,  GPIO_MRDY.LEVEL_SHIFTER,  GPIO_RESET.GPIO,                              GPIO_RESET.LEVEL_SHIFTER  are they required?

    how they need to be connected from IMX6 to CC2530?

    how they should be configured?

4. Since am using the generic SPI driver is there any changes related to SRDY / MRDY need to be done on generic spidev side ?