Adding an extra DDECK_FORCE to config.mk [SOLVED]

Firmware/software/electronics/mechanics
Jens_Lee
Member
Posts: 40
Joined: Sun Nov 19, 2017 8:14 pm

Adding an extra DDECK_FORCE to config.mk [SOLVED]

Post 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?
Last edited by Jens_Lee on Wed Jan 17, 2018 6:01 pm, edited 1 time in total.
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Adding an extra DDECK_FORCE to config.mk

Post 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
Jens_Lee
Member
Posts: 40
Joined: Sun Nov 19, 2017 8:14 pm

Re: Adding an extra DDECK_FORCE to config.mk

Post by Jens_Lee »

Hi Arnaud!

Cool, i will give it a shot. Thank you.
Jens_Lee
Member
Posts: 40
Joined: Sun Nov 19, 2017 8:14 pm

Re: Adding an extra DDECK_FORCE to config.mk

Post 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.
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

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

Post 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 :-).
Jens_Lee
Member
Posts: 40
Joined: Sun Nov 19, 2017 8:14 pm

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

Post 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.
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

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

Post 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).
Jens_Lee
Member
Posts: 40
Joined: Sun Nov 19, 2017 8:14 pm

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

Post 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]
Jens_Lee
Member
Posts: 40
Joined: Sun Nov 19, 2017 8:14 pm

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

Post by Jens_Lee »

Working now.

Thank you Arnaud for all the swift help!
arix
Member
Posts: 47
Joined: Fri Sep 01, 2017 1:45 am

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

Post 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.
Post Reply