LabVIEW Embedded

Showing results for 
Search instead for 
Did you mean: 

Use LabVIEW Embedded Module for ARM Microcontrollers to read data from SPI interface

Hi, Kevin
Thanks for your example. But when I run your code on the target, and connect these pins to logic analyzer, all pins' waveform is high.  How could this happen?
My c code through Keil uVision works well. And I successfully read data from sensor just as I mentioned before to set SSEL pin as GPIO pin
(set register "PINSEL1 |=  0x0000003C").
Maybe I will try to rewrite spi function through "inline c node function" provided by labview but I'm a newbie in labview programming. Can you help me to do this example?If you need my c code I can send to you.
I'm a grad student in the university. If I find the Evaluation Kit useful I will certainly recommend the department buy the long term one.
0 Kudos
Message 11 of 55
Hi liberty,
Did you connect to the 4 external pins that I did?
I am in the process of capturing the waveforms from all 4 pins in order to understand what I need to take into account with the possible chip select logic level differences.
Kevin S.
Applications Engineer
National Instruments
0 Kudos
Message 12 of 55
Yes, my connection to the 4 external pins is correct since I already saw the correct waveforms from Keil uVision programming.
0 Kudos
Message 13 of 55

I figure out part of my problem, because the  chip select logic level is active high all the time without any reason, if I set this pin as a triger signal in logic analyzer, there is no correct waveform.

But how to rewrite spi initialize function in labview as a simple one below:

 DWORD SPIInit( void ){

S0SPCR = 0x00;
 /* Configure Pin Connect Block */
 PINSEL0 &= ~0xC0000000;                       // clear pin settings
 PINSEL1 &= ~0x0000003C;                       // clear pin settings
 PINSEL0 |=  0xC0000000;                         // P0.15 (SCK) enable
    PINSEL1 |=  0x0000003C;                         // P0.17,18 (MISO, MOSI, ) enable;
    IOSET0 |= SPI0_SEL;                                   //port0.16 uses GPIO SPI_SEL,
 /* Enable SPI power */
 PCONP   |=  (1 << 8); 
 /* Set SPI clock*/
  //PCLKSEL0 |=  0x00030000
  /* Set SPI clock for 17~16 bit: 00------------- SPI_CLK=CCLK/4=12000000UL
            11------------- SPI_CLK=CCLK/8=6000000UL */
 S0SPCCR = 16;      //8 set clock rate S0SPCCR = SPI_CLK / (data_transfer_clockRate)
 //750 000UL
 S0SPCR =   (( clockPhase    & 1) << 3)             // set clock phase
             | ((~_clockPolarity & 1) << 4)               // set clock polarity
   //| (1 << 4)
             | (1 << 5)                                  // set master mode
             | (0 << 6)                                  // MSB trans. first    
             | (4 | (8 << 8));                           // set 8 bit data SPCR=0x0834
   // |4;
  return( TRUE );


0 Kudos
Message 14 of 55



Does anyone still have either the SPI example vi that Kevin_S posted, or even the .jpg's?  The content is no longer available through the post.


I am trying to get SPI communications up and running on the Luminary Micros ARM eval. kit.   Any help would be greatly appreciated!




0 Kudos
Message 15 of 55

Hi Adam,


Here are the images that were posted previously.


Kevn S.

Applications Engineer

National Instruments

Message Edited by Kevin_S on 03-03-2009 10:59 AM
Download All
0 Kudos
Message 16 of 55

Hi Kevin S,

I'm new on  Labview Embedded. I saw your message for example now. I couldn't take it.

if it's possible, can you share it again with us?

Thank you





0 Kudos
Message 17 of 55

Hi mguven,


Are you able to vew the JPEG images?  I would recommend using them as a guide as to what you can do.  The example is very simple.


Kevin S.

Applications Engineer

National Instruments

0 Kudos
Message 18 of 55



How about an example using the ARM as a slave?  I know you can't do it directly with the supplied LV vis (why?).  I tried to use MEM Peek/Poke to set it up myself, and those functions don't appear to work (why?).


NI support has been less than stellar on this.  Their answer seems to be "We don't use SPI much, so we can't help you"



Bill F

0 Kudos
Message 19 of 55

Hi Bill,


I'm talked with R&D about the use of an ARM as an SPI slave device.  Currently, it doesn't look like the ability to put the ARM device in slave mode has been integrated into a VI.  This option may be altered in C code (after the VI has been compiled down to C of course).  I've recommended directly to the developer about the desire for this feature.  For now, LabVIEW simply doesn't have a VI that can toggle that functionality though.


R&D is currently investigating the MEM Peek/Poke VIs.  I know that you've been in communication with one of my colleagues regarding this issue.  I encourage you to maintain your contact with her through your service request.


I apologize if NI's support hasn't been up to par with your questions.  I believe the biggest hurdle with the SPI VIs is custom example creation.  There's just too many SPI devices out there to create a good, generic example.  Don't worry though.  I've requested at this point any example of SPI bus usage as an example.



Kevin S.

Applications Engineer

National Instruments

Message Edited by Kevin_S on 03-20-2009 12:58 PM
0 Kudos
Message 20 of 55