Jump to content
igor

eLua for Stellaris Launchpad

Recommended Posts

Sorry, where did you say the source is located?    There doesn't appear to be a lm4 directory at https://github.com/ecdr/elua/tree/master/src/platform

 

Thanks,

David

 

First - you need to look in the LM4 branch (master is just a mirror of master in the main elua repository - makes it easier to manage the repository).

The directory you want is lm3s, i.e. https://github.com/ecdr/elua/tree/LM4/src/platform/lm3s

The LM4 is an update/newer version of the LM3S (TI bought it from Luminary Micros), so the LM4 support was added as an extension/update to the existing eLua LM3 support

(they all use same libraries, etc.).

 

The main files of interest are probably platform.c and platform_int.c in the above directory

The LM4 board descriptions are in elua/boards/known.

 

I have not yet pushed the files for the Tiva port to github.

The QEI support for Tiva is based on the lm3s_qei branch from this repository https://github.com/jsnyder/elua but there are some changes.   I will try to push the source or upload some documentation soon.

 

Update 24 Feb: The source for the Tiva launchpad port is now up in the TM4C branch (it is a branch of LM4).

The TM4-QEI branch has the QEI code.  The QEI interface is still in flux, so eLua function names and arguments may change.

https://github.com/ecdr/elua/tree/TM4C/src/platform/lm3s

Share this post


Link to post
Share on other sites

@@dpharris would you (or somebody else trying eLua on the Tiva LP) mind trying out the PWM to see if it is working?

Below is the PWMLED example https://github.com/ecdr/examples , adapted to the Tiva - hopefully it will fade the onboard LED.

Please let me know if it works or not.  Thanks.

-- eLua examples
-- Control LED intensity with PWM

local pwmid, tmrid, ledpin
if pd.board() == 'EK-TM4C123' then
  tmrid = 1
  pwmid = 13      -- RGB LED on PF1-3 (PWM 13-15)
  pwm.setclock( pwmid, 25000000 )
else
  print( pd.board() .. " not supported by this example" )
  return
end

print "Control LED with PWM (fade up/down)"
print "Press any key to exit"

local crtduty, incr = 10, 5
tmr.start( tmrid )
pwm.setup( pwmid, 50000, crtduty )
pwm.start( pwmid )

while uart.getchar( 0, 0 ) == "" do
  if crtduty == 95 or crtduty == 5 then
    incr = -incr
  end
  crtduty = crtduty + incr
  pwm.setup( pwmid, 50000, crtduty )  
  tmr.delay( tmrid, 50000 )  
end

pwm.stop( pwmid )

Share this post


Link to post
Share on other sites

I typed this in: 

> tmrid = 1

> pwmid = 13

> pwm.setclock( pwmid, 25000000 )

> tmr.start( tmrid )

> crtduty, incr = 10, 5

> pwm.setup( pwmid, 50000, crtduty )

 

And got: #####

 

And then no response, and I had to reset the board.  

Share this post


Link to post
Share on other sites

Thank you dpharris for running the test, and a especially thank you for the detailed feedback (i.e. entering it interactively) really helped to know which eLua statement failed. 

I fixed an error in pwm.setup and posted a new binary (replaced attachment in message 22, above).  If you feel like running the test again would appreciate.  

 

(If it doesn't work might be tidier to send me a PM with the symptoms/results.)

Share this post


Link to post
Share on other sites

eLua for TM4C 1294 connected launchpad (EK-TM4C1294)

 

It is untested at the moment (don't have a Tiva 1294 launchpad to try it on).

PIO works, UART works (at least on console)

PWM does not work.

 

If you try it and it works, please let me know what module(s) you tried.

If you try it and it doesn't work, likewise (plus indicate symptoms/error messages/etc.) and I will see if can fix problem.

 

It does not include support for Ethernet, nor for QEI.

While the other launchpad ports are integer only (due to limited RAM), this one should support floating point numbers.

 

Edit:

Revised 1 May - Fix some CAN problems, fix some pin configuration problems for SPI.

 

elua_lua_ek-tm4c1294.zip

Share this post


Link to post
Share on other sites

What baud rate should I be attempting? I'm getting garbage data in teraterm and putty no matter what I seem to specify and then it simply crashes after a few seconds.

 

115200, N, 8, 1

 

Be sure you have selected the right board in LMFlasher (or whatever programmer you are using).

Did you check that the download and flash went okay (i.e. try resetting/reflashing).

 

Which board are you using?  Which version of the processor does it have (if you know) - e.g. A1, B2 (think you have to read a chip register to find this).

Which binary did you use?  (I just posted ones for Connected LP as well as Tiva LP, so I need to know which version to look at).

 

If you press enter does the board seem to respond (i.e. print a few more characters of gibberish)?

Share this post


Link to post
Share on other sites

115200, N, 8, 1

 

Be sure you have selected the right board in LMFlasher (or whatever programmer you are using).

Did you check that the download and flash went okay (i.e. try resetting/reflashing).

 

Which board are you using?  Which version of the processor does it have (if you know) - e.g. A1, B2 (think you have to read a chip register to find this).

Which binary did you use?  (I just posted ones for Connected LP as well as Tiva LP, so I need to know which version to look at).

 

If you press enter does the board seem to respond (i.e. print a few more characters of gibberish)?

sorry I don't know the revision number.

I tried 115200-8n1. Board reset would spam some random characters onto the terminal, pressing keys would cause more characters which do not correspond to my key presses to appear, enter also fell into this category with random characters appearing. Few seconds of that and it just locks up entirely and needs resetting to get any response.

It is the tm4c1294XL launchpad board, this was the board selected in Lm flash with the tm4c1294 binary. I also had the verification tick box enabled and hardware reset between baud changes, have tried putty and teraterm.

Share this post


Link to post
Share on other sites

The binary worked for me no problems. I blinked some leds. My chip is marked: XM4C1294NCPDTI2

 

I was in the process of porting elua myself when I stumbled across this. Any possibility of putting the code online? I'm wanting ethernet and probably sdcard support. 

 

Thanks for the good work.

Share this post


Link to post
Share on other sites

The binary worked for me no problems. I blinked some leds. My chip is marked: XM4C1294NCPDTI2

 

I was in the process of porting elua myself when I stumbled across this. Any possibility of putting the code online? I'm wanting ethernet and probably sdcard support. 

 

Thanks for the good work.

 

Great.  If you get a chance to try any of the other peripherals, please let me know what works/doesn't work.

(e.g. PWM, SPI, xmodem, timer, adc, can)

 

I would be particularly interested in the results of this

print(cpu.clock())

for either the Tiva or the Tiva Connected (1294) launchpad.

(Should be 80 million, and 120 million respectively, but I have been having some problems with the clock speed code on tivaware).

 

There are a few sample programs in the romfs (type "ls" to list programs at the shell, type e.g. lua /rom/pwmled.lua to pwm demo.)

 

Since the networking library changed between Stellarisware and Tivaware, I had to do some rewriting of the network support.  

I have built a version with networking, will try to upload it in next few days.

 

Yes, the code for the Tivaware version will go up on github, that branch is a little bit messy, so I haven't pushed it (so I can do some rearranging in the repository if needed).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×