LabVIEW Embedded

cancel
Showing results for 
Search instead for 
Did you mean: 

ARM Module + LM3S8962 PWM problem

Solved!
Go to solution

Hi.

I'm experimenting with LV2009 + Embedded module for ARM (also 2009 version).

 

1) What actually works, some VIs I made (not provided examples):

- infinite loop + LED blinking + 200ms wait timer

- infinite loop + current iteration number on LCD + 200ms wait timer

 

2) The demos provided in  <LV>/examples/lvemb/ARM/LM3S8962  (DIO,PWM,Blinky,OLED) sistematicaly fail. Ex: DIO builds, but throws an exception when downloaded on the dev. boad and run; PWM fails to build (not a filled.ctl or update.ctl missing file issue, I fixed that) - something related to a PID subVI. What am I doing wrong here? Any help? (Note: I also changed the debugger & programmer settings for the uVision project, the default ULINK2 fails of course).

 

3) PWM EIO problem: I took the first VI mentioned at (1) above (LED blinky) and added a PWM5 EIO, in the same loop.

- what is the value wired to the PWM EIO node supposed to mean? Duty cycle 0 to 100? Duty cycle 0 to 1? Number of clock ticks for PWM high state? Sometimes it worked, sometimes the PWM was on logic high all the time.

- if I add a PWM5 EIO property node and try to set anything, the whole thing breaks. From what I saw in the uVision debugger, it gets stuck in the default interrupt handler section. I cannot figure out how it got there.

Please help me with a tested working example of how to completely set up a PWM EIO, with control over frequency, duty cycle, everything.

 

 

Thanks in advance for your time&help.

Paul. 

0 Kudos
Message 1 of 13
(10,093 Views)

Simple VI with a stacked sequence:

1) set PWM1 frequency to 2000 (EIO property node w/ constant 2000 wired)

2) set PWM1 duty cycle to 25 (EIO node w/ constant 25 wired?)

3) infinite while loop 

 

Everything is default, except I changed the debugger&programmer to "Luminary".

I debugged more thoroughly and the result is:

 

- processor defaults to  "Startup.s" -> ResetHandler (as expected)

- "IMPORT __main" -> OK

- "IMPORT SysCtlClockSet" -> OK

- clock/oscillator setup

"LDR        R0, =0x01C00380

 BL        SysCtlClockSet" 

-> OK

- "B       __main" -> fails; program gets stuck to

"FaultISR

 B       FaultISR"

 

Any ideea? I thought it was stack-sequence related; but it happens if I place the 3 pieces of code on the diagram without a sequence too.  

At this point, I`m beginning to think that NI rushed the release of the ARM module? ... Any help is most welcome!

 

PS: Any advice on how to use a timer in capture mode, with clock from an external source, in LV ARM? 

0 Kudos
Message 2 of 13
(10,087 Views)

Hi.

A screenshot is worth 1000 words, so:

 

1) works very nicely ...

 Screenshot.png

 

2) fails ( FaultISR ) ...

Screenshot-1.png

 

Same compiler/project settings for both cases, of course, the defaults shipped with LV ARM.

What am I missing here?!?!? 

Message 3 of 13
(10,076 Views)

More detailed info, from the debugging tools in uVision: the problem is a Bus Fault. BUS_FAULT_ADDR:0x40028040; BUS_FAULT_START:0x82. PRECISERR is checked, and also Hard Faults > FORCED is checked. May be useful info for someone trying to help ...

Thanks! 

0 Kudos
Message 4 of 13
(10,069 Views)

Hi Paul,

 

I have been looking into your questions, but have yet to be able to reproduce any of the errors you describe. I am continuing to investigate and will let you know when I have more information.

 

Regards, 

Will
CLA, CLED, CTD, CPI
LabVIEW Champion
Choose Movement Consulting
choose-mc.com
Message 5 of 13
(10,053 Views)

So does this mean that you succeeded to output, let's say, a 3kHz PWM on PWM5?

 

Another update: I tried placing just an inline C block in the VI, with nothing else. The code in the C block is the same provided as example with the LuminaryMicro peripheral driver library, that is actually behind LV ARM for LM3S8962.  Same results, bus addressing fault. Does not cause any problems when using the uV simulator, just on the actual hardware target. Any of the examples provided with the LuminaryMicro library (as uVision projects, written in C) work, so it is not the device that is faulty.

 

Thanks for your time,

Paul 

0 Kudos
Message 6 of 13
(10,032 Views)
Solution
Accepted by topic author Paul_Harfas

Hi Paul,

 

This looks like an issue where you (or rather LabVIEW generated code) are configuring the PWM peripheral before enabling the peripheral.  The target will fault in this case, but the simulator will not.  Because the PWM EIO node initializes and enables the PWM peripheral, if the EIO property node is executed before the EIO node, the target will fault.  Try using a sequence structure to ensure the PWM EIO node executes before the property node.

Message 7 of 13
(10,021 Views)

I agree, but that still doesn't solve the case where I only use a C node with the exact same code that works perfectly in a stand-alone uVision project...

Will try this trick in LV though. Supposed it works, this only leaves me with my next great dillema: how to use two of the timers in edge-to-edge externally triggered capture mode 🙂 

0 Kudos
Message 8 of 13
(10,004 Views)

Thanks vansick!

In what I'd call a highly counter-intuituve fashion, it worked. Flat sequence, 1st start the PWM, 2nd set PWM properties, 3rd infinite loop.

This leaves me with my timers problem mentioned above. Any help would be great. 

0 Kudos
Message 9 of 13
(9,983 Views)

Hi Paul,

 

Please start a new thread for your latest question. That will make it easier for others with the same question to find it.

 

Thanks,

Will
CLA, CLED, CTD, CPI
LabVIEW Champion
Choose Movement Consulting
choose-mc.com
0 Kudos
Message 10 of 13
(9,940 Views)