Solved: Thinary Nano Every ATmega4808 I2C TWI

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

 

Did anybody succeeded using Thinary Nano Every to work the LCD 20x4 on I2C interface?  

I connected as normal for Arduino Nano - SDA on A4 and SCL on A5. -GND +Vcc.

But the LCD does not work, it has backlight on. Changing the contrast with pot does not help.

 

I run on AS7 and Visual Micro plugin for Arduino.

The debugger shows that I am looping in twi.c library, lcd.init() function, line 326: 

 

        /* Arduino requires blocking function */
        while(master_result == TWIM_RESULT_UNKNOWN) {}
 

Any idea?

 

Thanks in advance. 

Best regards, Andrej

 

Andrej M

Last Edited: Sun. Aug 16, 2020 - 02:45 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Thinary board has PF2 and PF3 on A4, A5 pins.   These are the TWIS (Slave) pins.

If you want TWIM (Master) it is either on PA2, PA3 or on PC2, PC3 port pins.

 

If you want to use the Thinary Wire library (as Master) you should connect SDA to PA2 (D4) and SCL to PA3 (D5)

 

The regular Nano EVERY has PA2,PF2 hard-wired to A4 (SDA) and PA3,PF3 hard-wired to A5 (SCL)

This means that TWI is always on the same physical pins for the genuine EVERY.

 

Bill Perry's hd44780 library will work on Thinary if you:

1.  connect to SDA to D4 (PA2),  SCL to D5 (PA3)

2.  #define Serial Serial1

 

David.

 

p.s. Please could somebody explain why this "Thinary" thread has been split to some randomly named anonymous thread.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
p.s. Please could somebody explain why this "Thinary" thread has been split to some randomly named anonymous thread.

Well, it's not a "random" name - it's the standard way that split threads get named: "split from: <original-thread-name>"

 

It started as 'Thinary' her/himself trying to debug the design as a "sales pitch" in Marketplace:  https://www.avrfreaks.net/forum/nano-every-use-atmega4808

 

This was tacked-on as a hijack - unrelated to the original problem.

 

As  amla11  is now owner of this thread (s)he could now change the name to something more appropriate.  (s)he will also now be able to mark the solution once this problem is resolved ...

 

EDIT

 

Correct description of the original post.

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Wed. Jul 29, 2020 - 08:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry, I am a little late. I wired according to the David's explanation and the I2C  LCD works on Thinary Nano Every 4808 as expected. You should use the pins as described above D4 <-- SDA, D5 <-- SCL.  I used the Thinary Core, Wire & LCD libs on AS7 & VisualMicro. 

I also fount the definitions file in C:\Users\username\AppData\Local\Arduino15\packages\thinary\hardware\avr\1.0.0\variants\nona4808\pins_arduino.h , which helps for similar problems.

 

I would rename this chapter as "Thinary Nano Every ATmega4808 I2C TWI", if that's ok. 

 

Thanks again for help. 

Andrej

 

Andrej M