Trying to compile gateway firmware

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Trying to compile gateway firmware

Julius
Hi, I am trying to compile gateway firmware 1.7.5.3 on Arduino IDE. At first, I had problems with Ethernet library (it tried use included one instead of Teensy), but I have solved it by deleting included Ethernet library. However, I ran into another issue:

Arduino: 1.6.13 (Windows 10), Board: ""maniacbug" Mighty 1284P, JTAG disabled, 16Mhz Full Swing"

HardwareSerial0.cpp.o (symbol from plugin): In function `Serial':

(.text+0x0): multiple definition of `__vector_20'

libraries\NilGSM\NilGSM.cpp.o (symbol from plugin):(.text+0x0): first defined here

HardwareSerial0.cpp.o (symbol from plugin): In function `Serial':

(.text+0x0): multiple definition of `__vector_21'

libraries\NilGSM\NilGSM.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

Using library NilRTOS in folder: C:\Users\Julius\Documents\Arduino\libraries\NilRTOS (legacy)
Using library NilTimer1 in folder: C:\Users\Julius\Documents\Arduino\libraries\NilTimer1 (legacy)
Using library DigitalIO in folder: C:\Users\Julius\Documents\Arduino\libraries\DigitalIO (legacy)
Using library SPI at version 1.0 in folder: C:\Users\Julius\Desktop\arduino-1.6.13\hardware\arduino\avr\libraries\SPI
Using library Ethernet_Teensy at version 1.1.1 in folder: C:\Users\Julius\Documents\Arduino\libraries\Ethernet_Teensy
Using library Webduino-master in folder: C:\Users\Julius\Documents\Arduino\libraries\Webduino-master (legacy)
Using library PubSubClient at version 2.6 in folder: C:\Users\Julius\Documents\Arduino\libraries\PubSubClient
Using library RFM69-master in folder: C:\Users\Julius\Documents\Arduino\libraries\RFM69-master (legacy)
Using library NilAnalog in folder: C:\Users\Julius\Documents\Arduino\libraries\NilAnalog (legacy)
Using library TwiMaster in folder: C:\Users\Julius\Documents\Arduino\libraries\TwiMaster (legacy)
Using library Eeprom24C512 in folder: C:\Users\Julius\Documents\Arduino\libraries\Eeprom24C512 (legacy)
Using library RTClib in folder: C:\Users\Julius\Documents\Arduino\libraries\RTClib (legacy)
Using library NilRS485 in folder: C:\Users\Julius\Documents\Arduino\libraries\NilRS485 (legacy)
Using library NilGSM in folder: C:\Users\Julius\Documents\Arduino\libraries\NilGSM (legacy)
Using library WebSerial in folder: C:\Users\Julius\Documents\Arduino\libraries\WebSerial (legacy)
exit status 1
Error compiling for board "maniacbug" Mighty 1284P.

Can you help me with this issue? I also tried Arduino: 1.6.9 and I get exact same compilation error.
Reply | Threaded
Open this post in threaded view
|

Re: Trying to compile gateway firmware

vysocan
Administrator
Hello Julius,

yes, for Ethernet and other libraries you have to use the ones I have on GitHub, and remove the old ones. Best is to create separate copy of Arduino IDE environment just for gateway.

For Serial problem, it basically complain that gateway code is defining Serial 0 and Arduino is trying to initialize same Serial 0. Simple workaround is to find file HardwareSerial0.cpp, and change:
#if defined(HAVE_HWSERIAL0)
to
#if defined(_HAVE_HWSERIAL0)

I was not yet able to find the way to disable include of Arduino Serial 0, although disabling Serial 1 works just fine.

Serial 0 is defined in NilGSM.cpp(GSM modem routines), and Serial 1 NilRS485(RS485 routines).

Adam
Reply | Threaded
Open this post in threaded view
|

Re: Trying to compile gateway firmware

Julius
Ok, that seems to have solved the issue. Although, it says that "Low memory available, stability problems may occur." after compiling.

Looking at output directory, I have those two files among others:

OpenHomeSecurity.ino.hex
OpenHomeSecurity.ino.with_bootloader.hex

I suppose I should use the one with bootloader?

Reply | Threaded
Open this post in threaded view
|

Re: Trying to compile gateway firmware

vysocan
Administrator
Memory should not be problem, I use external editor, and I have following after compilation:
Sketch uses 109,386 bytes (84.1%) of program storage space. Maximum is 130,048 bytes.
Global variables use 15,018 bytes (91.7%) of dynamic memory, leaving 1,366 bytes for local variables. Maximum is 16,384  bytes.

If you have USB to serial working with 3V3, you just plug it in FTDI header and do standard Arduino upload. It has Arduino bootloader and it works like any Arduino board just select right USB port.

Just to say, every gateway and node has firmware already flashed in order to test them.

Adam
Reply | Threaded
Open this post in threaded view
|

Re: Trying to compile gateway firmware

Julius
This post was updated on .
Do I need to set any COM port settings (like baud rate or latency settings)? I am using FTDI programmer which looks exactly like in your web site and Arduino 1.6.9, however in the end I get the error:

avrdude: stk500_paged_load(): (a) protocol error, expect=0x14, resp=0x01
avrdude: stk500_cmd(): programmer is out of sync

(Just to clarify, send/receive leds blink pretty fast during the "upload" phase, but in the end i get the error)

EDIT: This is what I get trying to flash pre-compiled firmware using AVRDUDE: https://pastebin.com/Kn60jAtj

EDIT2: It seems that only the verification phase fails. I have changed some text in web ui and I can see those changes: https://imgur.com/a/I8f64
Reply | Threaded
Open this post in threaded view
|

Re: Trying to compile gateway firmware

vysocan
Administrator
It looks like the reading/verifying of written firmware does not receive correct data.

 I have similar behavior with one of my FTDI programmer, and I think that the problem is just Chinese copy of FTDI chip. There are many fake FTDI chips out there. The code is long so there is bigger chance to encounter error.

Try to upload it more then once, or use another Arduino with FTDI chip as programmer, or solder ISP header, and do upload via programmer in IDE.

Just curious, do you power the board externally when programming?

Adam
Reply | Threaded
Open this post in threaded view
|

Re: Trying to compile gateway firmware

vysocan
Administrator
In reply to this post by Julius
From picture it shows that the writing fails, you should not see "mod" after 1.7.5. Exactly like this:


Speed is 115200, and port is specified correctly, you would have no answer from chip.
Reply | Threaded
Open this post in threaded view
|

Re: Trying to compile gateway firmware

vysocan
Administrator
In reply to this post by Julius
Aha ,  you have added the "mod" there. Good.

 Well there might be some hidden error byte in the firmware. I would get another FTDI and try, it should go without error.
Reply | Threaded
Open this post in threaded view
|

Re: Trying to compile gateway firmware

Julius
This post was updated on .
Just tried flashing using CP2102 adapter - everything works fine.

I have one which looks like this one: https://ae01.alicdn.com/kf/HTB1d.S7PXXXXXaxXpXXq6xXFXXXi/CJMCU-CP2102-MICRO-USB-to-UART-TTL-Module-6Pin-Serial-Converter-UART-STC-Replace-FT232-NEW.jpg
Reply | Threaded
Open this post in threaded view
|

Re: Trying to compile gateway firmware

vysocan
Administrator
Nice to hear that :). Any 3V3 USB to serial should work as long as you connect it properly.