I’m working actually on project of UPS based on arduino mega 2560 proc.
So there is some problems to run a program, in a fact, that Verification is ok.
On the pins 18,19 and 3 is integrated Modbus TCP with module Waveshare (possible to see it on waveshare page). Next pins 20,21(I2C) communicate 2 pcs INA226 to get current measurement. Pin 32 inputs DS18b20 to check temperature for cooling with fan.
PCB was checked with quick own checker for HW functioning (relays, transistors etc.). Everything running correctly. Also with I2C checker I have checked INA226 and both have own, unique address.
But after I put a program to Arduino, nothing happens. Program is too difficult, may be problem will be in it, but, I think, that may be anything else …… INT0/INT1 …. but I have no experience with this. Is there any possibility to interaction between used libraries with mentioned interrupts ? Or will be really problem with part of program ?
Please, help, if you have any idea and if you have any time. Program is attached in this topic. Thanks for any help.
Your diagram is hard to follow, because you didn't adhere to the common schematic design rules. Signals from left to right, supply up, ground down. Using lines instead of supply and ground symbols makes it too cluttered to follow for anyone else than the designer itself.
Leo..
then I tested each subsystem separately, that it works (so no colisions from libraries)
then I added subsystem one by one and tested it still works (if it fails, last added is coliding with something older) (Here I can remove some older modules, utnil it works again and have other culprit)
after adding last subsystem everything worked well and I started program it to do something usefull
It is long way, but problems are found fast and are not so complicated.
Your project is different, but having interactive shell is really helpfull
@Wawa I know, but this is only working version and will be created by standard rules. So, there is not enough time actually. I have one running UPS with different PCB only at external RS485 by “lipstick” DR134 and MAX485 inside box UPS. And this version is OK. Last, above mentioned version I have tested by HW side separately, connected with cables on prototype shield outside and was running correctly.
So may be, that I have small bug in PCB ways. The fact is, that I have checked all components step by step. HW was checked really whole PCB and with testing program in arduino and each components are fully functional, but only Arduino not running, no outputs to relays …. may be really, that is there any interaction between libs ….. OK, I will try to working with schematic to standardize it and after it, I will try to separate revival process of components starting with communication, as described by @gilhad .
Mmmm, I am stupid. Everything is OK. But …. I have added wrong addres of INA226 I2C, and system could not recognize it and stuck the program ….. so, there is all OK, communicate and running whole the system.
Thanks to @gilhad to directions and I must open a schematic and put it to standards. But project is really good.
So you didn't write your code in stages.
Writing code for each bit of hardware first to prove you could communicate with it, would have shown you where your error was.
Can I suggest you do in future to help you write working code quicker.
@TomGeorge I know, sorry. This is always my problem, because …. I am wrinting each code in time press …. and this is all. So , I will try it in future … thanks.
Guys, is few months from my first post and after xmas I have founded problem.
This problem, where was stucked program in arudino is so simple, but to difficult to find it.
INA226 library causes this problem. If you put uncorrect addres I2C of INA in program, you have stuck it .. there is small bug in library, I think. It can be solved in future.