[Logo] TCC discussion forum
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Top Downloads] Top Downloads   [Groups] Back to home page 
[Register] Register /  [Login] Login 


This forum is read only and new users cannot register, please ask all new questions either using GitHub discussions, or in Arduino forum tagging @davetcc.

Using TcMenu with DS-1307 and RTClib.h RSS feed
Forum Index » tcMenu Arduinio library
Author Message
tr53


Joined: Aug 15, 2021
Messages: 3
Offline
First of all TCMenu et al is an amazing suite of tools! It seems to do almost anything I need. However I have a an Arduino Uno connected to a 20x4 LCD with 8574 (x27) I2c expander and a DS1307 (x68) on a I2C bus. The RTC responds to I2C commands until IOAbstractionWire with the call to setupMenu() in Setup(). So how can I use both devices. I have been looking through IOAbstractionWire.cpp and h.

TIA

T
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
Thanks for the feedback.

That seems to be a bit of a strange one, the only thing we do in IoAbstraction to enable the display is to call Wire.begin(..) and also do writes on the bus. It's highly unlikely to be interfering as I often use I2C EEPROMs at the same time. However, I don't use Wire much on the Uno as it needs quite a bit of RAM on its own.

Are you sure the Uno is not running out of memory? With Wire and another library along with TcMenu, it's probably using too much memory.
Are you using the Uno option for the LCD in the code generator display options?
What is the RAM usage percentage before the application starts?
tr53


Joined: Aug 15, 2021
Messages: 3
Offline
Well certainly program memory is getting tight... but nearly 50% of RAM remains...

******************
From compilation:
Sketch uses 28920 bytes (89%) of program storage space. Maximum is 32256 bytes.
Global variables use 1123 bytes (54%) of dynamic memory, leaving 925 bytes for local variables. Maximum is 2048 bytes.
******************

This project is to replace a Hobbes meter (engine hours meter) with a few other functions added in. The previous version of code would display time, motor elapsed time (saved in the DS1307 memory), Voltage, Water temp and ambient temperature. This does run in a previous version without an on board mechanism to enter time. That is to update /correct it other than pulling the AT328P and reprogramming it. And to update/set Elapsed time.

An actual Hobbes meter can cost for 40-50 us dollars. I was hoping to come in at about $25 for this replacement, not counting engineering time with added functionality.

Since I am not truly a programmer, I have tried a few other approaches such as OneButton and other menu libraries. This is a learning process and hope to use TCMenu in other much more UI intensive projects.

Back to the problem, I have a few recordings of the I2C bus both protocol and logic recordings. The protocol recordings showed the DS1307 address being queried to start with until about startMenu() kicked off. I need some more time to check the commands and replies. it initially looks like the it gets through RTC clock running and squarewave output check and then DS1307 address isn't queried again. However the logic analyzer shows what might be a periodic error on the I2C bus. So I have a few things to look at and I am going to replace the I2C LCD display with a direct connect display if I can tradeoff the IO pins . Having the additional wires is a mechanical issue in packing it all into a small water resistant box.

So I will press on as....

TIA

T
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
In terms of I2C, if you're already using it for something else, nothing would really be saved by not using it for the display. Wire will be brought in to communicate with your other I2C device. Personally, I suspect memory is exhausting.

Memory that's available at compile time does not equal what's needed to initialize at runtime. There are a few single allocations made during initialization. This is made up of tasks for task-manager, switches settings, and a small amount of memory for dialogs and buffers. This could make the memory very tight indeed with only 2K available. You can lower the number of tasks and switches, but they are already set really small for Uno.

You could try switching to No Display and No Input required plugins in code generator and see if that works. Or instead in the projectName_menu.cpp code you could try commenting out all the code to do with the renderer, and see what happens.
tr53


Joined: Aug 15, 2021
Messages: 3
Offline
Thanks will try these!

TIA

T
 
Forum Index » tcMenu Arduinio library
Go to:   
Mobile view
Powered by JForum 2.7.0 © 2020 JForum Team • Maintained by Andowson Chang and Ulf Dittmer

This site uses cookies to analyse traffic, serve ads by Google AdSense (non-personalized in EEA/UK), and to record consent. We also embed Twitter, Youtube and Disqus content on some pages, these companies have their own privacy policies.

Our privacy policy applies to all pages on our site

Should you need further guidance on how to proceed: External link for information about cookie management.