April 27, 2024, 08:11:55 PM

Programming MOD-IO

Started by vikingaca, April 12, 2013, 06:03:26 PM

Previous topic - Next topic

vikingaca

Hello everybody:-)
I am a new guy in this, so I have a lot of questions about programming MOD-IO. How can I "put" some program into MOD-IO? I am familiar with Olimex LPC2138/48, but there I can use an UART for programming... Should I use UEXT here (or something else, JTAG is out of my reach), is there any special hardware that I need for this? I often use IAR kickstart and makeapp for building programe (LPC2148), but what apps should I use for ATmega (MOD-IO)? I will be greatfull if someone recomended me some *.pdf book for learning about this stuff... I alredy have official ATmega16.pdf, but something shorter will do better. Thanks a lot, and sorry for my English!

LubOlimex

Hello vikingaca,

MOD-IO comes with built-in firmware. If you initially want to just use MOD-IO you might use the built-in firmware. There are couple of commands available for the most common uses of MOD-IO. The documentation on the web page specifies how these commands are performed and what is the data format. A good idea is to check on the examples provided.

If you wish to modify the firmware you'd need an ATmega16 compatible programmer/debugger (the board has both ISP and JTAG connectors). Checking the firmware listed below is highly recommended when doing modifications. Some low-cost Olimex programmers for AVR include - AVR-ISP-MK2 https://www.olimex.com/Products/AVR/Programmers/AVR-ISP500/ and AVR-ISP500-TINY https://www.olimex.com/Products/AVR/Programmers/AVR-ISP500-TINY/.

The board might contain one of these firmwares depending on the purchase date and the retail method when purchasing:
- Latest firmware: https://www.olimex.com/Products/Modules/IO/MOD-IO/resources/MOD-IO(I2C-Slave)_v1.02.zip
- Previous version of the firmware: https://www.olimex.com/Products/Modules/IO/MOD-IO/resources/MOD-IO-UART_Commands.zip

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

vikingaca

Thanks LubOlimex,
My initial idea was to connect MOD-IO with LPC2148 via UEXT. I was very confused with  a lot of programmers and software, but finaly I decided to buy AVR-ISP-MK2 or AVR-ISP500, and to use AVR studio. I hope that it is a good combination, and that will be easy to switch from LPC on AVR. Do You have some better idea about software? After a reading of lot docs, I still do not understand how to communicate with MOD-IO without AVR-programmers. Even if I use firmware included, and connect MOD-IO with PC Hyper terminal, I need some wiring, and as much as I can see, only available ports for this are UEXT, EXT and AVRISP. Maybe to use LPC2148 to send I2C commands over UEXT?
Thanks once again, and best regards!
vikingaca

LubOlimex

Hey vikigaca,

Maybe to use LPC2148 to send I2C commands over UEXT?
Yes. You communicate between LPC2148 and MOD-IO via the I2C interface. You send the commands defined in the firmware and read the response. The I2C pins are located on the UEXT. More information about UEXT on the following two pages:

http://en.wikipedia.org/wiki/UEXT
https://www.olimex.com/Products/Modules/UEXT/

AVR studio is good. I even prefer AVR studio 4 to the newer 5th and 6th versions since they add only clunkiness and features I never use. Migrating from ARM to AVR is much easier than the other way around. ARM is hardest to master architecture.

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

vikingaca

Thanks again LubOlimex,
for Your quick answers and for links...I am going to try to connect devices this way... but I also want a programmer. So which one should I buy: AVR-ISP-MK2 or AVR-ISP500? AVR Studio 4 is my choice too.

Best regards,
vikingaca

LubOlimex

Both will work in your case. ISP-MK2 has TPI and PDI interfaces and may work under Linux after firmware upgrade. However AVR-ISP500 is easier to use and has both the older 2x3 ISP connector and the newer 2x5 ISP connector (ISP-MK2 lacks 2x3). Both work with Atmel Studio 6.0. 

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

vikingaca

Thanks a lot,
You realy make my day:-) I'll order my gear today. Since I live in Belgrade, Serbia, there is Olimex resailer (www.comet.rs). Thanks a lot once again!
Best regards,

vikingaca

le_top

Hi
Adding on to this thread as this concerns the MOD-IO and the firmware.

We bought an IO-MOD recently (April 2013) directly through the Olimex site and we could not get it to work neither through I2C nor RS232.
We ended up plugging the board to "hyperterminal" using the USB/RS232 cable.
The prompt that shows up is the following:

**** AVR MOD-IO CONTROL ****
****(C) 2009, OLIMEX Ltd****

Test Optocouples. Press 'S' to start the test...


Neither of the source codes refered to above correspond to this firmware.  The RS232 version says "(C) 2010".  We did not plan on buying a programmer for this module, so:
1) Where can we find the source code for the firmware that is in our MOD-IO.  Can we control the IO at all ? (besides the test modes);
2) Suggestions to be able to control this board without changing the firmware (requiring a programmer)?


LubOlimex

Hey le_top,

All code is available on the MOD-IO's web page under the SOFTWARE section: https://www.olimex.com/Products/Modules/IO/MOD-IO/. There are instructions in the readme.txt.

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

le_top

Thank you for the reply, however I have checked this link prior to posting as well as the github contents to find that the source code there does not correspond to the code in the device.

The RS232 code in the link that was provided contains:
   strcpy(Txt, "************************"); PrintLn(Txt);
   strcpy(Txt, "*       AVR MOD-IO     *"); PrintLn(Txt);
   strcpy(Txt, "* (C) 2010, OLIMEX Ltd *"); PrintLn(Txt);
   strcpy(Txt, "************************"); Print(Txt);

and is therefore different from the verbatim copy that I provided earlier that indicate "(C) 2009 ..." which is a year earlier - the title is also different (says CONTROL while the source code online does not say 'CONTROL').
The behavior expressed in the available source code does not correspond to the behavior of the code that is in the MOD-IO that was received.