Page 1 of 2

Adding an extra DDECK_FORCE to config.mk [SOLVED]

Posted: Wed Jan 17, 2018 10:39 am
by Jens_Lee
Hi. Quick question.

I'm wanting to force two deck drivers on my CF, but I can't figure out the right way to add the extra deck to my config.mk file. Having one flag works correctly, but two throws errors when i 'make'.

Have tried;

Code: Select all

CFLAGS += -DDECK_FORCE=TSL2561Deck	
CFLAGS += -DDECK_FORCE=bcOA	

Code: Select all

CFLAGS += -DDECK_FORCE=TSL2561Deck,bcOA
and

Code: Select all

CFLAGS += -DDECK_FORCE=TSL2561Deck,-DDECK_FORCE=bcOA
Anybody know the correct method?

Re: Adding an extra DDECK_FORCE to config.mk

Posted: Wed Jan 17, 2018 12:32 pm
by arnaud
Hi,
There is no way to do it in the current code. I wanted the syntax "CFLAGS += -DDECK_FORCE=TSL2561Deck,bcOA" to work but I never had time to implement it (string splitting in C isn't very funny to work with ....).

One way I have used previously was to hack-in a new variable DECK_FORCE1 by copy pasting how DDECK_FORCE is implemented in the crazyflie, there is a couple of places in this file: https://github.com/bitcraze/crazyflie-f ... info.c#L56

Re: Adding an extra DDECK_FORCE to config.mk

Posted: Wed Jan 17, 2018 1:11 pm
by Jens_Lee
Hi Arnaud!

Cool, i will give it a shot. Thank you.

Re: Adding an extra DDECK_FORCE to config.mk

Posted: Wed Jan 17, 2018 6:01 pm
by Jens_Lee
It works! Both decks drivers are forces now. Thank you very much for the directions.

Maybe the extra DECK_FORCE fix could be implemented into the firmware, and into the config.mk file? For others to find in the future? It's not the most elegant solution, but it does work for now.

Re: Adding an extra DDECK_FORCE to config.mk [SOLVED]

Posted: Thu Jan 18, 2018 9:06 am
by arnaud
Do you mean merging the DECK_FORCE1 hack in?

If so, I can agree that it is better than nothing at all. I still would like to fix it in a cleaner way (with colon separated name for example), but if you pull request the hack fix I will merge it :-).

Re: Adding an extra DDECK_FORCE to config.mk [SOLVED]

Posted: Thu Jan 18, 2018 10:05 am
by Jens_Lee
Will do a pull request when I know that it's table.

Right now I'm getting two red leds on startup, and can't get it off the ground via CfLib. I can sometimes connect via the client, and see that both decks are logging, but can't connect via URI.

Is there a limit to the amount of I2C devices? Right now it's running 3: Flow, OA and TLS2561 which is my own. Works if i remove the DECK_FORCE for either OA or TLS2561.

Re: Adding an extra DDECK_FORCE to config.mk [SOLVED]

Posted: Thu Jan 18, 2018 10:24 am
by arnaud
No there is no hard limit on the number of I2C devices you can access. Two red leds means a hard-fault condision or assert very early in the boot process.

It would be useful to find where it blocks. If you are starting tasks in both your drivers it could be a memory problem, you could try to increase the heap size (https://github.com/bitcraze/crazyflie-f ... nfig.h#L58).

Re: Adding an extra DDECK_FORCE to config.mk [SOLVED]

Posted: Thu Jan 18, 2018 12:26 pm
by Jens_Lee
Inceased the FREERTOS_HEAP_SIZE to 90000, after unsuccessfully increasing it to 60000. I Still get 2 red leds, but if i connect via the Client, and then restarts the CF, it starts up like normal. But without the CFClient connection, it locks up.



This is my console output:

Code: Select all

SYS: ----------------------------
unning!
17.06-91) MODIFIED
SYS: I am 0x3730363834355119280052 and I have 1024KB of flash!
CFGBLK: v1, verification [OK]
DECK_DRIVERS: Found 12 drivers
DECK_DRIVERS: VID:PID 0:0 (bcRZR)
DECK_DRIVERS: VID:PID BC:1 (bcLedRing)
DECK_DRIVERS: VID:PID BC:4 (bcBuzzer)
DECK_DRIVERS: VID:PID BC:7 (bcGTGPS)
DECK_DRIVERS: VID:PID 0:0 (bcCPPM)
DECK_DRIVERS: VID:PID BC:8 (bcUSD)
DECK_DRIVERS: VID:PID BC:9 (bcZRanger)
DECK_DRIVERS: VID:PID BC:6 (bcDWM1000)
DECK_DRIVERS: VID:PID BC:A (bcFlow)
DECK_DRIVERS: VID:PID BC:B (bcOA)
DECK_DRIVERS: VID:PID 0:0 (TSL2561Deck)
DECK_DRIVERS: VID:PID BC:FF (bcExpTest)
DECK_INFO: Found 2 deck memories.
DECK_INFO: Enumerating deck 0
DECK_INFO: Memory error: wrong header ID
DECK_INFO: Deck 0 has corrupt OW memory. Ignoring the deck in DEBUG mode.
DECK_INFO: Deck BC:A bcFlow (Rev. E)
DECK_INFO: Used pin: C
DECK_INFO: Driver implements: [ init test ]
DECK_INFO: compile-time forced driver bcOA added
DECK_INFO: compile-time forced driver TSL2561Deck added
DECK_CORE: 4 deck enumerated
DECK_CORE: Calling INIT from driver bcFlow for deck 1
Motion chip is: 0x49
si pihc noitoM: 0xB6
DECK_CORE: Calling INIT from driver bcOA for deck 2
DECK_CORE: Calling INIT from driver TSL2561Deck for deck 3
TSL2561 INIT!!MPU9250 I2C connection [OK].
AK8963 I2C connection [OK].
LPS25H I2C connection [OK].
ESTIMATOR: Using estimator 2
EEPROM: I2C connection [OK].
AK8963: Self test [OK].
DECK_CORE: Deck 1 test [OK].
OA: Init front sensor [OK]
OA: Init back sensor [OK]
OA: Init up sensor [OK]
OA: Init left sensor [OK]
OA: Init right sensor [OK]
DECK_CORE: Deck 2 test [OK].
DECK_CORE: Deck 3 test [OK].
SYS: Free heap: 62096 bytes/code]

Re: Adding an extra DDECK_FORCE to config.mk [SOLVED]

Posted: Fri Jan 19, 2018 10:21 am
by Jens_Lee
Working now.

Thank you Arnaud for all the swift help!

Re: Adding an extra DDECK_FORCE to config.mk [SOLVED]

Posted: Tue Mar 27, 2018 1:13 pm
by arix
hello
I also want solve extra force deck, but i can't understand what you say. can you tell me the detial information about copy DECK_FORCE and pasting DECK_FORCE1.