Yenya / ibus-altitude-sensor

I-Bus Altitude Sensor for FlySky Telemetry
GNU General Public License v2.0
28 stars 3 forks source link

how to make it work? #2

Closed Lenrockus closed 5 years ago

Lenrockus commented 5 years ago

Hi, can you please explain, how to make it work and use your device. My steps was: 1 made a very simple diy arduino board(small one), it doesn't have any usb-uart chip on it, only 2 compile source code , using winavr and last avr toolchain 3.6.2, selecting mcu=328 and bmp085, getting lots of warnings and hex file of 16kb. here is compiling log.

`C:\ibus-altitude-sensor-master>make

-------- begin -------- avr-gcc (AVR_8_bit_GNU_Toolchain_3.6.2_1759) 5.4.0 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiling C: bmp085/bmp085.c avr-gcc -c -mmcu=atmega328p -I. -gdwarf-2 -DF_CPU=16000000UL -DSENSOR_BMP085 -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fpack-struct -fshort- enums -Wall -Wstrict-prototypes -Wa,-adhlns=./bmp085/bmp085.lst -std=gnu99 bmp 085/bmp085.c -o bmp085/bmp085.o In file included from bmp085/bmp085.c:18:0: bmp085/bmp085.h:69:1: warning: function declaration isn't a prototype [-Wstrict- prototypes] extern void bmp085_init(); ^ bmp085/bmp085.h:70:1: warning: function declaration isn't a prototype [-Wstrict- prototypes] extern int32_t bmp085_getpressure(); ^ bmp085/bmp085.h:71:1: warning: function declaration isn't a prototype [-Wstrict- prototypes] extern double bmp085_getaltitude(); ^ bmp085/bmp085.h:72:1: warning: function declaration isn't a prototype [-Wstrict- prototypes] extern double bmp085_gettemperature(); ^ bmp085/bmp085.c:71:6: warning: function declaration isn't a prototype [-Wstrict- prototypes] void bmp085_getcalibration() { ^ bmp085/bmp085.c:102:6: warning: function declaration isn't a prototype [-Wstrict -prototypes] void bmp085_getrawtemperature() { ^ bmp085/bmp085.c:122:6: warning: function declaration isn't a prototype [-Wstrict -prototypes] void bmp085_getrawpressure() { ^ bmp085/bmp085.c:163:8: warning: function declaration isn't a prototype [-Wstrict -prototypes] double bmp085_gettemperature() { ^ bmp085/bmp085.c:173:9: warning: function declaration isn't a prototype [-Wstrict -prototypes] int32_t bmp085_getpressure() { ^ bmp085/bmp085.c:181:8: warning: function declaration isn't a prototype [-Wstrict -prototypes] double bmp085_getaltitude() { ^ bmp085/bmp085.c:189:6: warning: function declaration isn't a prototype [-Wstrict -prototypes] void bmp085_init() { ^

Compiling C: ibus-sensor.c avr-gcc -c -mmcu=atmega328p -I. -gdwarf-2 -DF_CPU=16000000UL -DSENSOR_BMP085 -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fpack-struct -fshort- enums -Wall -Wstrict-prototypes -Wa,-adhlns=./ibus-sensor.lst -std=gnu99 ibus- sensor.c -o ibus-sensor.o In file included from ibus-sensor.c:8:0: bmp085/bmp085.h:69:1: warning: function declaration isn't a prototype [-Wstrict- prototypes] extern void bmp085_init(); ^ bmp085/bmp085.h:70:1: warning: function declaration isn't a prototype [-Wstrict- prototypes] extern int32_t bmp085_getpressure(); ^ bmp085/bmp085.h:71:1: warning: function declaration isn't a prototype [-Wstrict- prototypes] extern double bmp085_getaltitude(); ^ bmp085/bmp085.h:72:1: warning: function declaration isn't a prototype [-Wstrict- prototypes] extern double bmp085_gettemperature(); ^

Compiling C: i2chw/twimaster.c avr-gcc -c -mmcu=atmega328p -I. -gdwarf-2 -DF_CPU=16000000UL -DSENSOR_BMP085 -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fpack-struct -fshort- enums -Wall -Wstrict-prototypes -Wa,-adhlns=./i2chw/twimaster.lst -std=gnu99 i 2chw/twimaster.c -o i2chw/twimaster.o

Linking: ibus-sensor.elf avr-gcc -mmcu=atmega328p -I. -gdwarf-2 -DF_CPU=16000000UL -DSENSOR_BMP085 -Os -f unsigned-char -funsigned-bitfields -ffunction-sections -fpack-struct -fshort-enu ms -Wall -Wstrict-prototypes -Wa,-adhlns=bmp085/bmp085.o -std=gnu99 bmp085/bmp 085.o ibus-sensor.o i2chw/twimaster.o --output ibus-sensor.elf -Wl,-Map=ibus-sen sor.map,--cref -Wl,--relax -Wl,--gc-sections -lm

Creating load file for Flash: ibus-sensor.hex avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature ibus-sensor.elf i bus-sensor.hex

Creating load file for EEPROM: ibus-sensor.eep avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \ --change-section-lma .eeprom=0 --no-change-warnings -O ihex ibus-sensor.elf ibus -sensor.eep || exit 0

Creating Extended Listing: ibus-sensor.lss avr-objdump -h -S -z ibus-sensor.elf > ibus-sensor.lss

Creating Symbol Table: ibus-sensor.sym avr-nm -n ibus-sensor.elf > ibus-sensor.sym

Size after: text data bss dec hex filename 5484 6 70 5560 15b8 ibus-sensor.elf

-------- end --------

C:\ibus-altitude-sensor-master>`

3) uploaded code via Xloader to my arduino board and connect the board to ia6b as shown in the schematic, shorting rx to tx with a jumper. And get nothing (( I cannot see any telemetry data from receiver. What I do wrong? I use 1.7.5 firmware on transmiter https://github.com/qba667/FlySkyI6/releases/download/1.7.5/fs-i6_vario_deadband.zip and https://github.com/povlhp/FlySkyRxFirmware/blob/master/firmwares/iA6B_1.6.bin firmware on receiver.

Yenya commented 5 years ago

Hello,

you can safely ignore the warnings, it is older C dialect in the bmp085 library.

So I presume your board has ATmega 328p and you have a BMP085 sensor. Does your board have any LEDs? It is possible to guess the program status from them, because the code tries to blink LED when receiving data from BMP and when communicating with RX.

I only have BMP180 and BMP280 sensors, but the library should support BMP085 as well.

I can send you a testing code which does not communicate with the BMP sensor at all, but sends a virtual sensor info to the RX, so that we can test at least this part of communication.

FWIW, I use stock firmware in my receivers, but I hope povlhp firmware is compatible with them.

Lenrockus commented 5 years ago

my board does not have any leds, only mega328 and bmp085, it works ok with bmp085 test code from arduino ide, but looking with oscilloscope , I can't see any data on i2c bus with the firmware that I get from source code. Proteus simulation didn't show as well any data on i2c. I belive that it is somthing wrong with my code. Could you please add hex files for mega328/32u4 with bmp085/280 and test code to release page?

Lenrockus commented 5 years ago

it works, just added 10k pullup resistors to i2c. Thank you!