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,


I saw the screen shots of your example, but they don't address the issue I am having.  I am experiencing the exact same issue as Liberty.  I have a SPI device in which I must set the SSEL as a GPIO (P0.16) and then toggle that GPIO low while I send my SPI message.  I have changed the ARM_SPI.c file to accomodate the change.  


new - PINSEL1  |= 0x0000003C   

Old -  PINSEL1  |= 0x0000003F


How can I toggle the GPIO P0.16 in LabVIEW?  I am using LabVIEW 8.6.  






0 Kudos
Message 31 of 55



        This is an old thread and instead of looking through all the old posts why don't you tell us what hardware are using, what you're trying to do, and what problems you are running into. I see that you are wanting to send a bit to the GPIO P0.16 to make it high/low but what hardware is this on? Thanks!!


Grant H.

0 Kudos
Message 32 of 55

HI Grant,


I am using the Keil MCB2300 Evaluation Kit.  The specific processor on the evaluation kit is the LPC2387.  I am trying to communicate to an LTC1856 ADC.  I have the MOSI, MISO, SCK, and SSEL lines (pins 86, 87, 89, and 90) from the Evalation Kit connected to my device.  The chip select needs to go low when the SPI communication takes place.  Normally it stays high.  So I changed the ARM_SPI.c file located in C:\Program Files\National Instruments\LabVIEW 8.6\Targets\Keil\Embedded\RealView\MCB2300\Template\Drivers\SPI to make the SSEL be used as a GPIO16.  In theory, I should be able to set the GPIO line to low, right before I transmit my SPI message, then set it back high, once my SPI message is done. 
0 Kudos
Message 33 of 55



You have two options.


You could change to the LPC2378 target and use an EIO node.  You would need the PO16 node found under digital input.  Once you drop this node you can change it to be digital ouput.


Another option - if you don't want to change your target or deal with EIO, is to directly use the code that the EIO relies on.  However, things may go wrong as EIO handles a bit of extra things (such as possible hardware conflicts).  You can find a VI (C:\Program Files\National Instruments\LabVIEW 8.6\vi.lib\Embedded\ARM\MCB2300\ that can be used to directly toggle any GPIO pin.  This VI does not have a block diagram, as it is implemented in C code.  If you are curious, you can find the source at C:\Program Files\National Instruments\LabVIEW 8.6\Targets\Keil\Embedded\lib\MCB2300_DIO.c (The VI calls the MCB2300_DigitalOutput(...) function directly)





0 Kudos
Message 34 of 55

How do you could change to the LPC2378 target and use an EIO node?  If I open my ARM palette I have 2 EIO options.  Property Node and EIO node.  I can configure the EIO node as a digital output, but the only options are for the LEDs on the development kit.  The only digital input option is for the INT0 button on the development kit.  How would I get access toPO16?



0 Kudos
Message 35 of 55

You must create another target in your project (New > Targets and Devices...) and copy your VIs over to the new target (do not copy EIO, etc).  You can create the LPC2378 by first adding the "Other" target.  Once you add this target you can right click on the "Other" target and specify it as the LPC2378. 


The LPC2378 targets the processor, rather than the board.  So you won't see peripherals that are only present on the board (e.g. LEDs), but you can use more GPIO.

0 Kudos
Message 36 of 55

I created a new project with the target being the LPC2378.  However when I put down an EIO node, I have nothing to select.  See attached screen shot.  I also haven't activated LabVIEW yet.  Could this be an issue?



0 Kudos
Message 37 of 55

Oh...  I forgot you must select the elemental I/O as well.  Right click the target again and choose "Select Elemental I/O..." and select the EIO for the MCB2300G.


If this still doesn't work try re-creating the target again.


And a found a guide on this.

Message Edited by Gmg on 05-15-2009 04:44 PM
0 Kudos
Message 38 of 55

I was able to add the correct EIO to my project.  I created a small app to constantly toggle the line.  However the SSEL/P016 line stays high at 3.3V.  I had tried modifying the ARM_SPI.c file (located in C:\Program Files\National Instruments\LabVIEW 8.6\Targets\Keil\Embedded\RealView\MCB2300\Template\Drivers\SPI) to change the SSEL behavior, but it did not make a difference.  Is there anything else that I need to do to setup the SSEL line for GPIO P016? 




Download All
0 Kudos
Message 39 of 55

Well, that's a bug..


The EIO is modifying the fast GPIO registers, but the chip is configured to use the slow/legacy GPIO registers for port 0 and port 1.  To fix this problem:


1.  Open the template project in microvision IDE (located at  C:\Program Files\National Instruments\LabVIEW 8.6\Targets\Keil\Embedded\RealView\Generic\LPC2378\Template\Project\LabVIEW.Opt)  Note you will need to do this for all targets you wish to use these ports as GPIO.


2.  Open the LPC2300.s file and modify the following line:

SCS_Val         EQU     0x00000021


3.  Save and close out of microvision.


4.  Delete the generated code for your LabVIEW project and do another build (This will force LabVIEW to copy the template project again).


Now you should be able to toggle lines on Port 0/1 fine.  However, I did some testing and it appears that one canot toggle the lines at P0.15-18 (hardware/jumper issues perhaps), but all the others seem to work fine.   So I would suggest using another pin as your SSEL.



0 Kudos
Message 40 of 55