AnsweredAssumed Answered

JN5168 I2C and SPI

Question asked by Subin Chen on Sep 20, 2018
Latest reply on Sep 27, 2018 by Estephania Martinez

Hi Everyone,

I used Coordinator project from JN-AN-1189-ZigBee-HA-Demo to debug I2C and SPI, but it seems they all can't work. Can you help me about this problem, thanks.

 

PUBLIC void APP_vInitialiseCoordinator(void)

{...

vAHI_SiMasterConfigure(TRUE, //bPulseSuppressionEnable,
FALSE, //bInterruptEnable,
31); //uint8 u8PreScaler); //16M/((scale+1)*5) = 100k

 

vAHI_SpiConfigure(0 /* u8SlaveEnable */,
FALSE /* bLsbFirst */,
FALSE /* bPolarity */,
FALSE /* bPhase */,
8 /* u8ClockDivider */,
FALSE /* bInterruptEnable */,
FALSE /* bAutoSlaveSelect */);

vAHI_SpiSelect( 0 );

}

 

OS_TASK(APP_taskBlinkLED)
{
static bool bToggle=FALSE;
/*Stop the timer and start it agian*/
OS_eStopSWTimer(APP_tmrLEDBlinkTimer);
OS_eStartSWTimer(APP_tmrLEDBlinkTimer,APP_TIME_MS(500),NULL);

vAHI_SpiStartTransfer(7, 0x55); ////// SPI

///I2C
vAHI_SiMasterWriteData8( 0x55 );
bAHI_SiMasterSetCmdReg(FALSE,
FALSE,
FALSE,
TRUE,
E_AHI_SI_SEND_NACK,
E_AHI_SI_NO_IRQ_ACK);


if(bToggle == TRUE)
{
bToggle=FALSE;
/*SetLEDs ON*/
vAHI_DioSetOutput(0,LED_NWK_FORMED);
if(ZPS_bGetPermitJoiningStatus())
vAHI_DioSetOutput(LED_PERMIT_JOIN,0);
}
else
{
bToggle=TRUE;

/*Set LEDs OFF*/
vAHI_DioSetOutput(LED_NWK_FORMED,0);
vAHI_DioSetOutput(0,LED_PERMIT_JOIN);
}
}

Outcomes