Page 2 of 3

Re: Mixing channels to create 3-way switch ?

PostPosted: Fri Mar 02, 2012 8:28 pm
by Tom
Just download the latest source code from the SVN and it contains both MpLab and MpLab X project files?

Re: Mixing channels to create 3-way switch ?

PostPosted: Mon Mar 05, 2012 11:15 am
by cassini
Ok, thanks. Major problem now though-

I opened the project file (from 0.5.1 because i didn't know how to download from the source tab) in MPLAB and edited the bits I wanted (just the two lines as shown by DaveK) and exported a .hex

However, something must've been wrong with my settings. The firmware upgrade was successful, but now the log just looks like-

????????????????????????????????????J?????????HGJHGH etc. constantly updating
the sensors aren't responding

and I can't write any new firmware - the terminal repeats 'hardware detected framing errror' then closes. (tried with the new 0.8 hex too)

any ideas... ? :(

hope I haven't bricked the device... not sure where I went wrong though.

Thanks.

Re: Mixing channels to create 3-way switch ?

PostPosted: Mon Mar 05, 2012 11:26 am
by Tom
You really should download the code from the SVN. It is not so hard. Download TortoiseSVN or something similar.

The version you have is old and still at 115200 baud...

Re: Mixing channels to create 3-way switch ?

PostPosted: Mon Mar 05, 2012 11:47 am
by cassini
It should still work though? I can't update the firmware at all at the moment, even the new 0.8.

when trying to update to 0.8, the dsLoader output -

Initiating write...
Searching for bl .
Found dsPIC33FJ128MC710A fw ver. 4.3.11
Wrong pic detected(84)/selected(199), aborting
Tx 19 byte / Rx 3 bytes / 1.5s
Write failed

Is there a 'hard reset' or something I can do?

Re: Mixing channels to create 3-way switch ?

PostPosted: Mon Mar 05, 2012 12:21 pm
by Tom
Hmm... You could try to connect the FTDI cable to the module when the console screen says "looking for bootloader...". The bootloader is only active during the first few milliseconds of power-up.

The problem is that the module is now working at 115200 baud, and the reset command gluonconfig sends doesn't work because it is being sent at 57600 baud...

Here you can download a separate GUI for the programmer.

Re: Mixing channels to create 3-way switch ?

PostPosted: Mon Mar 05, 2012 12:33 pm
by cassini
Hmm, not sure what I did but seems to be working with 0.8 now.

Got the SVN now, so I'm going to attempt uploading the custom code again. Just checking, in MPLAB-

the compiler 'C30' s ok?

Re: Mixing channels to create 3-way switch ?

PostPosted: Mon Mar 05, 2012 12:34 pm
by cassini
under 'select compiler' it says 'dsPIC(none found)'

Re: Mixing channels to create 3-way switch ?

PostPosted: Mon Mar 05, 2012 12:37 pm
by Tom
You'll need to download the dspic c30 compiler from the microchip website.

Re: Mixing channels to create 3-way switch ?

PostPosted: Mon Mar 05, 2012 2:34 pm
by cassini
Thanks! Firmware uploading seems to be working just fine!

Hmm, adding the following code -

-----------------------------------
if (!ppm.connection_alive || ( ppm.channel[4] > 1700 && ppm.channel[5] > 1700 ))

{
control_state.flight_mode = AUTOPILOT;
-----------------------------------

and

------------------------------------
else if (ppm.channel[4] > 1700 && ppm.channel[5] < 1300)

{
control_state.flight_mode = STABILIZED;
-----------------------------------


as DaveK suggested, doesn't seem to work quite right. As viewed in GCS, the flight mode seems to cycle randomly regardless of channels 4 and 5. It seems as though there is another setting somewhere.

EDIT - actually the mode now seems to controlled solely by channel 5.. how strange!

Couple of thoughts -

1. Where can 'channel.ap' be accessed? I can't find the part where ppm.channel[1],[2] etc are assigned to pitch, roll etc. Maybe I should alter that too?

2. In Gluon config, what should I do about the dot matrix where channels are assigned? Maybe that setting is overriding the code in control.c?

Many thanks.

Re: Mixing channels to create 3-way switch ?

PostPosted: Mon Mar 05, 2012 4:58 pm
by cassini
SORTED!

Woooohooo. That shouldn't have taken so long.... :D

My mistake - using ppm.channel[4] instead of [3] ... :oops: total noob error ahah.

Thanks Tom!