How to use pio functions?

classic Classic list List threaded Threaded
4 messages Options
Roman Roman
Reply | Threaded
Open this post in threaded view
|

How to use pio functions?

Hi,

I'm trying to run script LED.lua from examples, but I have problem with pio function -

error:
stdin:1: attempt to index global 'pio' (a nil value)                            
stack traceback:                                                                
        stdin:1: in main chunk                                                  
        [C]: ?  

My script:
  local uartid, invert, ledpin = 0, false
  ledpin = pio.PF_2

 function cycle()
   pio.pin.sethigh( ledpin )
   tmr.delay( 0, 500000 )
   pio.pin.setlow( ledpin )
   tmr.delay( 0, 500000 )
 end

 pio.pin.setdir( pio.OUTPUT, ledpin )
 
 while uart.getchar( uartid, 0 ) == "" do
   cycle()
 end

I was trying use function - module(...) - but then I have this error:
stdin:1: bad argument #1 to 'module' (string expected, got no value)            
stack traceback:                                                                
        [C]: in function 'module'                                              
        stdin:1: in main chunk                                                  
        [C]: ?


My platform is LM3S and version of my eLUA is v0.9.
In board configuration in theory I have added pio module:
  components = {
    sercon = { uart = 0, speed = 115200 },
    wofs = true,
    romfs = true,
    --shell = true,
    advanced_shell = true,
    term = { lines = 25, cols = 80 },
    cints = true,
    lm3s_pio = true;
    rpc = { uart = 0, speed = 115200 },
    adc = { buf_size = 2 },
    xmodem = true,
    linenoise = { shell_lines = 10, lua_lines = 30 }
  },
  modules = {
    generic = { 'all', '-pio', '-cpu', '-i2c', '-net' },
    platform = {'all'}
 }

Does anybody have any idea what I do wrong?

Best
Roman
Roman Roman
Reply | Threaded
Open this post in threaded view
|

Re: How to use pio functions?

Maybe I have to put name of the module in module("some module name")?
But what modules do I have to add?

Best ,
Roman  
jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Re: How to use pio functions?

In reply to this post by Roman
Did you try this before you adjusted your configuration file?

The items with dashes in front of them in the modules section will actually disable them:
  modules = { 
    generic = { 'all', '-pio', '-cpu', '-i2c', '-net' }, 
    platform = {'all'} 
 } 

So this disables pio, cpu, i2c & net.  the 'all' should include pio.

You can check that modules have been built in to your project by typing something like:
print(pio)

at the prompt.  If present you should see a response like:
romtable: 0x2eac0

Best.

-jsnyder

On Fri, Sep 5, 2014 at 9:29 AM, Roman [via eLua Development] <[hidden email]> wrote:
Hi,

I'm trying to run script LED.lua from examples, but I have problem with pio function -

error:
stdin:1: attempt to index global 'pio' (a nil value)                            
stack traceback:                                                                
        stdin:1: in main chunk                                                  
        [C]: ?  

My script:
  local uartid, invert, ledpin = 0, false
  ledpin = pio.PF_2

 function cycle()
   pio.pin.sethigh( ledpin )
   tmr.delay( 0, 500000 )
   pio.pin.setlow( ledpin )
   tmr.delay( 0, 500000 )
 end

 pio.pin.setdir( pio.OUTPUT, ledpin )
 
 while uart.getchar( uartid, 0 ) == "" do
   cycle()
 end

I was trying use function - module(...) - but then I have this error:
stdin:1: bad argument #1 to 'module' (string expected, got no value)            
stack traceback:                                                                
        [C]: in function 'module'                                              
        stdin:1: in main chunk                                                  
        [C]: ?


My platform is LM3S and version of my eLUA is v0.9.
In board configuration in theory I have added pio module:
  components = {
    sercon = { uart = 0, speed = 115200 },
    wofs = true,
    romfs = true,
    --shell = true,
    advanced_shell = true,
    term = { lines = 25, cols = 80 },
    cints = true,
    lm3s_pio = true;
    rpc = { uart = 0, speed = 115200 },
    adc = { buf_size = 2 },
    xmodem = true,
    linenoise = { shell_lines = 10, lua_lines = 30 }
  },
  modules = {
    generic = { 'all', '-pio', '-cpu', '-i2c', '-net' },
    platform = {'all'}
 }

Does anybody have any idea what I do wrong?

Best
Roman


If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/How-to-use-pio-functions-tp7578445.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: (847) 448-0386
Roman Roman
Reply | Threaded
Open this post in threaded view
|

Re: How to use pio functions?

In reply to this post by Roman
Great, this answer solved my problem.
Tanks.