cancel
Showing results for 
Search instead for 
Did you mean: 

SPIRIT1 Example Code

CKels
Associate

I am adding the SPIRIT1 to legacy products that already have a specified MCU.  I have the purchased the full STEVAL-IKR002V3 Eval Kit and two additional daughter boards.  My MCU is able to read/write to the SPIRIT1 registers, but I cannot figure out how to get the device to actually transmit.  I believe everything is configured correctly (by duplicating the register map from the GUI).  When I watch the SPI communication from the eval MCU to the daughterboard, it appears that the mask registers are constantly being read and then written to.

Can someone please provide a set of example commands for transmission?  The datasheet is quite vague, and does not offer any examples. 

Can someone provide the code used in the eval kit?  I do not want to purchase IAR or any other tool.  I simply want to view the file and duplicate the portion I need in my IDE.

Any help is appreciated. 

3 REPLIES 3
Winfred LU
ST Employee

Hi,

If radio and GPIOs are configured properly and only transmission parts are interested,

please refer to SDK_BasicGeneric_A.c and check the main loop:

  while (1){   
#ifdef USE_VCOM
    printf("A data to transmit: [");
    
    for(uint8_t i=0 ; i<20 ; i++)
      printf("%d ", vectcTxBuff[i]);
    printf("]\n\r");
#endif
    
    /* fit the TX FIFO */
    SpiritCmdStrobeFlushTxFifo();
    SpiritSpiWriteLinearFifo(20, vectcTxBuff);
    
    /* send the TX command */
    SpiritCmdStrobeTx();
    
    /* wait for TX done */
    while(!xTxDoneFlag);
    xTxDoneFlag = RESET;
 
    /* pause between two transmissions */
    SdkDelayMs(500);
  }

All actions are done through SPI, explained as below

  1. Send the FLUSHTXFIFO command (0x72) to flush TX FIFO
  2. Write TX FIFO with vectcTxBuff[]
  3. Send the TX command to transmit

Best Regards,

Winfred

CKels
Associate

​Hello Winfred,

Thank you for the response.  I will try this today and get back with you. 

I do have one more question about the STEVAL-IKR002V3D Daughter Board hardware.  The schematic shows that the current can be read using an ammeter after removing the jumper at U2.  This all works fine, and the current I measure matches well with what the datasheet says.  However, when I remove the ammeter and the jumper, the Daughter Board still functions properly.  This should not be so, because the jumper should connect the supply voltage to the VBAT1 and VBAT2 pins.  Obviously, there is some error in the schematic, and you can verify this by simply pulling the jumper and still operating the STEVAL-IKR002V3D Daughter Board.  Is there an updated schematic available that addresses this discrepancy?  After I get this to transmit, I am immediately cutting new PCBs for evaluation and would like to be sure of how this should be laid out.  Also, Altium files (.PCBDOC) for the Daughter Board would be quite helpful as well.  I am unable to open the Gerbers supplied on the STMicro website.

Hi ckelsoe1,

From the schematic, i agree with you that U2 jumper is to connect 3V3 and VBAT1, VBAT2.

It is strange that removing U2 jumper the daughter board still works. I am not able to explain either.

Sorry that I don't have the kits to replicate, but i'll try to check if anyone had similar questions.

As for Altium files for the EVB, i would suggest to ask your local FAE to support. Probably he can also answer the question about U2.

Thank you.

Best Regards,

Winfred