Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - Issues with "Compile Atmel AVR-GCC" using Arduino Uno

(you are viewing a thread; or go back to list of threads)

Issues with "Compile Atmel AVR-GCC" using Arduino Uno (by OnosTech)
Hello José, Ihor & Team

I have been experimenting with "Compile Atmel AVR-GCC" using the latest version of Atmel Studio. The issues I have encountered so far are:
1. https://github.com/LDmicro/LDmicro/issues/227
2. https://github.com/LDmicro/LDmicro/issues/228
3. I first upload a blink code to Arduino Uno with the Call FlashMCU as a guide. Then add the I2C code as shown in the attachment and upload again. The onboard LED will not flash with the addition of the I2C. I have also tried out some of your examples on this forum as well as with older version of C down to 3.5.0.1, but the LED always stop blinking when the I2C function is introduced. Maybe something is wrong with I2C generated code.

I have tried the blink program with other functions like the ADC, UART and SPI, everything works fine. Please help check out what is wrong. I am just going by with C programming.

Looking forward to your response.



Hola José, Ihor y equipo

He estado experimentando con "Compile Atmel AVR-GCC" usando la última versión de Atmel Studio. Los problemas que he encontrado hasta ahora son:
1. https://github.com/LDmicro/LDmicro/issues/227
2. https://github.com/LDmicro/LDmicro/issues/228
3. Primero subo un código intermitente a Arduino Uno con Call FlashMCU como guía. Luego agregue el código I2C como se muestra en el adjunto y cargue nuevamente. El LED integrado no parpadeará con la adición del I2C. También probé algunos de sus ejemplos en este foro, así como con una versión anterior de C hasta 3.5.0.1, pero el LED siempre deja de parpadear cuando se introduce la función I2C. Tal vez algo esté mal con el código generado por I2C.

He probado el programa blink con otras funciones como ADC, UART y SPI, todo funciona bien. Por favor ayude a ver qué está mal. Solo estoy pasando con la programación en C.

Esperamos su respuesta.
Thu Feb 18 2021, 07:17:16
(no subject) (by OnosTech)
See attachment
Thu Feb 18 2021, 07:18:05, download attachment Blink With I2C.rar
(no subject) (by José)

Hi OnosTech

I can't open your rar file (corrupted ?)

Please attach your ladder in zip format and specifie
your version of ldmicro and your target.

José
Sun Mar 7 2021, 02:59:10
(no subject) (by OnosTech)
Hi José,

I am so glad you are taking out time to look into this issue.

Attached is the zip file. I am using the latest version 5.4.0.5. The target is Arduino Uno/nano.

A similar complaint from another user is that adding several compare variable instructions in series on the same rung will not work with "Compile Atmel AVR-GCC", but works very well with "Compile Sketch for Arduino". When his program was "Compile Atmel AVR-GCC" on my HP Pavilion laptop with Windows 10 Home Edition, it worked. The target was Arduino nano and V5.4.0.5.

Thanks very much for your great work. I am earnestly looking forward to a solution to this.

Onos
Sun Mar 7 2021, 14:43:45, download attachment Blink With I2C.zip
(no subject) (by OnosTech)
Hi Jose,

For the AVRGCC, I am using Atmel Studio 7.

Onos
Sun Mar 7 2021, 22:19:21
(no subject) (by José)
Hi

Your problem is just that your led is connected to Y2= Pb5...

But on Arduino-Uno, Pb5 is also the pin for I2C clock SCK.
You can't use both at the same time.

Change pin and it should be OK !
Pb0 for instance is not used by any peripheral.

José
Thu Mar 11 2021, 11:02:13
(no subject) (by OnosTech)
Hi Jose,

Many thanks for your feedback. I have used the Pb0 as you recommended as well as other pins. But the LED still doesn't blink when the I2C function is used. I will really appreciate further recommendations from you.

Onos
Thu Mar 11 2021, 15:56:33
(no subject) (by José)
Well...

Is there any I2C device really connected to your µC ?

If not, it can't work because most I2C instructions are waiting for an "ack" of the connected device.
And without it, it blocks your program !

I2C instructions can't be used "for fun"...

Does it solve your issue ?

BR
José
Fri Mar 12 2021, 10:27:45
(no subject) (by OnosTech)
Hi Jose,

This is very insightful. I have an I2C LCD connected. Now, I am suspecting it may not be good enough even though it worked with another Arduino code. I will have to order from another supplier. This might solve the problem. Stuff like this can also be fun too.

Many thanks for the direction.

Best Regards
Onos
Fri Mar 12 2021, 17:01:33
(no subject) (by OnosTech)
Hi Jose,

I finally got the exact type of the I2C LCD module in the library pdf file and it works fine. It turns out to be that the module I have been using is very different and may not be providing the required "ack".

I am very grateful for your help.

Best Regards
Onos
Sun Mar 14 2021, 16:02:18
(no subject) (by José)
OK.

That's fine !

Jose
Tue Mar 16 2021, 02:28:27
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):