Driver I2C 100% Lua

classic Classic list List threaded Threaded
10 messages Options
1100F 1100F
Reply | Threaded
Open this post in threaded view
|

Driver I2C 100% Lua

Hi EveryBody

I place today my first contribution on GitHub, but i'm not sure to make
correctly...

follow https://github.com/AlbertFERNANDES/elua-i2c

Is a driver I2C with basics functions.

To follow, functions for PCF8583

Best,

Albert FERNANDES
--


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
http://www.avast.com

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Tom Freund-2 Tom Freund-2
Reply | Threaded
Open this post in threaded view
|

Re: Driver I2C 100% Lua

Albert.

Went over the source. 

Have you thought of applying this technique to SPI ?

If eLua already has an I2C function library, why was elua-i2c created ?


On Thu, Jan 16, 2014 at 11:11 AM, Albert FERNANDES <[hidden email]> wrote:
Hi EveryBody

I place today my first contribution on GitHub, but i'm not sure to make correctly...

follow https://github.com/AlbertFERNANDES/elua-i2c

Is a driver I2C with basics functions.

To follow, functions for PCF8583

Best,

Albert FERNANDES
--


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
http://www.avast.com

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
Tom Freund

dig.y.SoL

"Systems overseeing 
public and private
infrastructure"

LinkedIn - http://www.linkedin/in/digysol
Voice - 860-232-1614





_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|

Re: Driver I2C 100% Lua

 Hi Tom,


On Thu, Jan 16, 2014 at 6:19 PM, Tom Freund <[hidden email]> wrote:
Albert.

Went over the source. 

Have you thought of applying this technique to SPI ?

If eLua already has an I2C function library, why was elua-i2c created ?

Currently, eLua's I2C library (and platform interface) is lacking in many ways (mostly because my lack of knowledge regarding various implementations of I2C interfaces from various manufacturers at the time I've designed that) and probably needs a complete redesign. I understand the need for alternate solutions. Since I2C is a low speed interface, a bit-banged Lua implementation is suitable in this case. Not so much with SPI, because that works at much higher speeds.
Albert, that looks very nice! Thank you.

Best,
Bogdan
 


On Thu, Jan 16, 2014 at 11:11 AM, Albert FERNANDES <[hidden email]> wrote:
Hi EveryBody

I place today my first contribution on GitHub, but i'm not sure to make correctly...

follow https://github.com/AlbertFERNANDES/elua-i2c

Is a driver I2C with basics functions.

To follow, functions for PCF8583

Best,

Albert FERNANDES
--


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
http://www.avast.com

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
Tom Freund

dig.y.SoL

"Systems overseeing 
public and private
infrastructure"

LinkedIn - http://www.linkedin/in/digysol
Voice - 860-232-1614





_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
1100F 1100F
Reply | Threaded
Open this post in threaded view
|

Re: Driver I2C 100% Lua

In reply to this post by Tom Freund-2
Hi Tom,

SPI module is implementing over most platform, but not i2c :-(

I make this lua code for my usage, for i/o expander (PCF8574) and rtc (PCF8583).

Best'

Albert


Le 16/01/2014 17:19, Tom Freund a écrit :
Went over the source. 

Have you thought of applying this technique to SPI ?

If eLua already has an I2C function library, why was elua-i2c created ?


--



Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection Antivirus avast! est active.



_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Tom Freund-2 Tom Freund-2
Reply | Threaded
Open this post in threaded view
|

Re: Driver I2C 100% Lua

In reply to this post by BogdanM
Bogdan, thanks for the explanation.

I am using eLua for product development and just wanted to get an understanding of what the driver was for the project.

Now, going back to SPI, does the same apply to the eLua SPI function library ? Any issues there ?


On Thu, Jan 16, 2014 at 11:25 AM, Bogdan Marinescu <[hidden email]> wrote:
 Hi Tom,


On Thu, Jan 16, 2014 at 6:19 PM, Tom Freund <[hidden email]> wrote:
Albert.

Went over the source. 

Have you thought of applying this technique to SPI ?

If eLua already has an I2C function library, why was elua-i2c created ?

Currently, eLua's I2C library (and platform interface) is lacking in many ways (mostly because my lack of knowledge regarding various implementations of I2C interfaces from various manufacturers at the time I've designed that) and probably needs a complete redesign. I understand the need for alternate solutions. Since I2C is a low speed interface, a bit-banged Lua implementation is suitable in this case. Not so much with SPI, because that works at much higher speeds.
Albert, that looks very nice! Thank you.

Best,
Bogdan
 


On Thu, Jan 16, 2014 at 11:11 AM, Albert FERNANDES <[hidden email]> wrote:
Hi EveryBody

I place today my first contribution on GitHub, but i'm not sure to make correctly...

follow https://github.com/AlbertFERNANDES/elua-i2c

Is a driver I2C with basics functions.

To follow, functions for PCF8583

Best,

Albert FERNANDES
--


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
http://www.avast.com

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
Tom Freund

dig.y.SoL

"Systems overseeing 
public and private
infrastructure"

LinkedIn - http://www.linkedin/in/digysol
Voice - 860-232-1614





_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
Tom Freund

dig.y.SoL

"Systems overseeing 
public and private
infrastructure"

LinkedIn - http://www.linkedin/in/digysol
Voice - 860-232-1614





_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|

Re: Driver I2C 100% Lua

On Thu, Jan 16, 2014 at 6:32 PM, Tom Freund <[hidden email]> wrote:
Bogdan, thanks for the explanation.

I am using eLua for product development and just wanted to get an understanding of what the driver was for the project.

Now, going back to SPI, does the same apply to the eLua SPI function library ? Any issues there ?

The SPI interface is much better. You can probably use that without worries.

Best,
Bogdan
 


On Thu, Jan 16, 2014 at 11:25 AM, Bogdan Marinescu <[hidden email]> wrote:
 Hi Tom,


On Thu, Jan 16, 2014 at 6:19 PM, Tom Freund <[hidden email]> wrote:
Albert.

Went over the source. 

Have you thought of applying this technique to SPI ?

If eLua already has an I2C function library, why was elua-i2c created ?

Currently, eLua's I2C library (and platform interface) is lacking in many ways (mostly because my lack of knowledge regarding various implementations of I2C interfaces from various manufacturers at the time I've designed that) and probably needs a complete redesign. I understand the need for alternate solutions. Since I2C is a low speed interface, a bit-banged Lua implementation is suitable in this case. Not so much with SPI, because that works at much higher speeds.
Albert, that looks very nice! Thank you.

Best,
Bogdan
 


On Thu, Jan 16, 2014 at 11:11 AM, Albert FERNANDES <[hidden email]> wrote:
Hi EveryBody

I place today my first contribution on GitHub, but i'm not sure to make correctly...

follow https://github.com/AlbertFERNANDES/elua-i2c

Is a driver I2C with basics functions.

To follow, functions for PCF8583

Best,

Albert FERNANDES
--


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
http://www.avast.com

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
Tom Freund

dig.y.SoL

"Systems overseeing 
public and private
infrastructure"

LinkedIn - http://www.linkedin/in/digysol
Voice - 860-232-1614





_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



--
Tom Freund

dig.y.SoL

"Systems overseeing 
public and private
infrastructure"

LinkedIn - http://www.linkedin/in/digysol
Voice - 860-232-1614





_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
1100F 1100F
Reply | Threaded
Open this post in threaded view
|

Driver I2C 100% Lua, update with RTC

In reply to this post by 1100F
Hi Again!

Repo updated with lua code for RTC/PCF8583

https://github.com/AlbertFERNANDES/elua-i2c/tree/I2C

Enjoy!

Albert'
> --


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
http://www.avast.com

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Martin Guy Martin Guy
Reply | Threaded
Open this post in threaded view
|

Re: Driver I2C 100% Lua

In reply to this post by 1100F
On 16/01/2014, Albert FERNANDES <[hidden email]> wrote:
> follow https://github.com/AlbertFERNANDES/elua-i2c
>
> Is a driver I2C with basics functions.

Nice. Giving us dozens of I2C interfaces on all platforms with GPIOs!

If you are interested in improving it, I have some suggestions:
- I2C frequency setting? Some devices have a maximum speed that they
can respond to, whereas this just runs as fast as possible.  However,
that's probably not important in practice.  It's be interesting to
know what frequency it runs at, how many bits per second it transmits
on your platform,which you can probably calculate by sending 100kb of
data at full speed and timing it in seconds.
- There's another part of I2C, "clock stretching", also for slow
devices. A slave can pause the master's clock while it processes data
and gets ready for the next bit by holding the clock low, so the
master should check that the clock really is high before driving it
low. See the example of "i2c bit banging" in wikipedia for the exact
algorithm.
- Is your Lua-fu strong enough to redefine i2c.*() so that it
implements the same interface as eLua's I2C module? That would make
all existing eLua I2C code be able to use your i2c interface
immediately without modification, and would avoid people having to
write every program twice, once for eLua 12c.*() and once for your
interface.  I guess you'd need a specialised setup function (or have 2
extra optional parameters in your version) to specify the two pio pins
to be used by the new I2C ID that i2c.setup() would create when it is
called.

Thanks!

    M
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
1100F 1100F
Reply | Threaded
Open this post in threaded view
|

Re: Driver I2C 100% Lua

Hi Martin,

Thank you for your comments and suggestions!
The driver i2c we wrote (my brother and me) to a PCF8574 and PCF8583 on STM32F103 because the i2c module is not currently supported by elua for our platform. We did not care for respect speed : we even removed all delays : it's going as fast as possible on a microcontroller with 72Mhz ! Can be slow by inserting delays , especially for faster microcontrollers as STM32F407 Discovery ( 168MHz! ) . We planned to test this code for F407 and F429 Discovery in February.
We do not have either intended to manage the non-response of the slave ( just a configurable retry for acknowledgment) . Normally, this Lua code should run on all platforms until the i2c module is implemented . This is why we chose native i2c pins ...
I had already carries i2c parallel port on PC in 2002, with visual basic . See : http://1100f.free.fr/tout_sur_le_bus_i2c.htm . In french only !

PS: I do not understand anything in C, but i like Lua !


Best'

Albert

Le 17/01/2014 02:57, Martin Guy a écrit :
On 16/01/2014, Albert FERNANDES [hidden email] wrote:
follow https://github.com/AlbertFERNANDES/elua-i2c

Is a driver I2C with basics functions.
Nice. Giving us dozens of I2C interfaces on all platforms with GPIOs!

If you are interested in improving it, I have some suggestions:
- I2C frequency setting? Some devices have a maximum speed that they
can respond to, whereas this just runs as fast as possible.  However,
that's probably not important in practice.  It's be interesting to
know what frequency it runs at, how many bits per second it transmits
on your platform,which you can probably calculate by sending 100kb of
data at full speed and timing it in seconds.
- There's another part of I2C, "clock stretching", also for slow
devices. A slave can pause the master's clock while it processes data
and gets ready for the next bit by holding the clock low, so the
master should check that the clock really is high before driving it
low. See the example of "i2c bit banging" in wikipedia for the exact
algorithm.
- Is your Lua-fu strong enough to redefine i2c.*() so that it
implements the same interface as eLua's I2C module? That would make
all existing eLua I2C code be able to use your i2c interface
immediately without modification, and would avoid people having to
write every program twice, once for eLua 12c.*() and once for your
interface.  I guess you'd need a specialised setup function (or have 2
extra optional parameters in your version) to specify the two pio pins
to be used by the new I2C ID that i2c.setup() would create when it is
called.

Thanks!

    M

---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
http://www.avast.com


--



Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection Antivirus avast! est active.



_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Dado Sutter Dado Sutter
Reply | Threaded
Open this post in threaded view
|

Re: Driver I2C 100% Lua, update with RTC

In reply to this post by 1100F
Thank you!!!

Best
Dado




On Thu, Jan 16, 2014 at 3:25 PM, Albert FERNANDES <[hidden email]> wrote:
Hi Again!

Repo updated with lua code for RTC/PCF8583

https://github.com/AlbertFERNANDES/elua-i2c/tree/I2C

Enjoy!

Albert'
--


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
http://www.avast.com

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev