ERSKY9X Coding

erskyTx runs on many radios and upgrade boards
ersky9x was a port of er9x for use on the sky9x board.
SkyNorth
Posts: 958
Joined: Tue Dec 27, 2011 11:40 am
Country: -
Location: Mansfield , Ontario

Re: ERSKY9X Coding

Post by SkyNorth »

Good stuff Mike , we can use a potato for backup ;-)

Instead of using a attiny pin to detect a power down , could the Soft Power routine of the ARM not send a command to the co-processor to go into sleep mode?

Could you read the temp sensor on the Tiny , and use that a reference to calibrate the ARM sensor?
Its got to be more accurate than the ARMS' !

-Brent

Wallcrasher
Posts: 7
Joined: Tue Sep 25, 2012 12:18 am
Country: -

Re: ERSKY9X Coding

Post by Wallcrasher »

Hi all, i have a question about the sub trims feature on the t9x.
my question is, knowing that when you want to setup the servos in a model and that you have installed the servo arms and want to have the arms 90 degrees or as close as possible and using the sub trims on the transmitter to get the servo arms at the preffered position precicely.

1).Does that shift the neutral point on the sticks and does it affect the amount of total travel on each side (end point!) ??

2). will the sub trims settings show on the main screen or is it only the trim settings when the model has been trimmed in the air.

3). Will the sub trims affect any other settings like d/r expo , or mixes.

Thanks!
:|
User avatar
terabyte
Posts: 39
Joined: Mon Aug 13, 2012 7:43 pm
Country: -
Location: Ft. Lauderdale, FL, USA
Contact:

Re: ERSKY9X Coding

Post by terabyte »

Mike I have one of these; http://www.eevblog.com/projects/ucurrent/
Do you just need to test how much power draw is on the main battery when the board is off?
http://farm9.staticflickr.com/8092/8470213998_eb5aff468b_b.jpg
User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: ERSKY9X Coding

Post by Kilrah »

Wallcrasher wrote:Hi all, i have a question about the sub trims feature on the t9x.
Subtrims don't move end points, they only move the center. They thus alter "gain" on both sides (say you set limits as default +/-100%, and then add +80% subtrim, your travel on one side will then be tiny, from +80% to +100%, while the other way will be huge, from +80% to -100%.

It's perfect and easy for single-control functions. With more complex mixings you might want to look at open9x, which offers a different option where subtrim maintains uniform gain (and instead clips output if it exceeds limits).
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: ERSKY9X Coding

Post by MikeB »

Real Time Clock seems to now be working fine. I can even set the date/time from a menu.
I've put a 2.4V, 100mAh NiCd I had on as battery backup. While 2.4V is a bit low, my AtTiny keeps the clock running at 2.1V so I should be OK.

It needs a bit more work on the menu, but this should be in the next revision.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: ERSKY9X Coding

Post by MikeB »

terabyte: Thanks, but the backup power is a separate source to the main battery.

I thought the supercaps would be OK, but they seem to discharge more quickly than I would expect. Seem to have a self discharge of 2.5 to 3 uA. I'm staying with the 2.4V NiCd for the moment, may get a 2.4V NiMh later.

I've got rid of the pin to detect the power, I'm able to monitor the I2C signal lines to give the same function. If they are both low, for long enough, with no transistions, then I switch to sleep mode until they come back up. Seems to be working fine.

I now need to update the applet used to program the Tiny. The applet now needs to knock the Tiny out of application mode, back into bootloader mode, otherwise tha application never stops due to the battery backup.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: ERSKY9X Coding

Post by MikeB »

r116 now released.

Voice for thousands fixed (I think!)
Some types of WAV file headers read properly now, mainly 16kHz, 8-bit with an extra field in the header.
RPM numeric display improved, doesn't go negative above 32767 RPM
Real Time Clock added to co-processor
Menu added to allow RTC to be set
Co-processor applet updated

In order to be able to re-program the co-processor, after you first set the RTC running, you will need to update your SAM-BA, co-processor applet. It is on the ersky9x site now, but here is the revised 'bin' (zipped).
applet-coprocessor-atsam3s4.zip
(996 Bytes) Downloaded 291 times
Updated 29/09/2012 23:00

You may also need to update the .tcl file in the same directory with:
at91sam3s4-9x.zip
(2.22 KiB) Downloaded 304 times
Updated 29/9/2012

In directory tcl_lib\common, you will probably also need to update generic.tcl with this one, SAVE your old one just in case.
generic.zip
(14.67 KiB) Downloaded 268 times
There is a new menu, in the RADIO SETUP menus (LEFT LONG, then RIGHT several times) called DATE-TIME. Here you can see the current date and time, and also set new values.

If you want the date and time to keep running when you switch the Tx off, you need to provide a battery backup for the co-processor.
The backup supply voltage must not exceed 3.3 volts.
There is a 3-pin header, labelled BATTERY BACKUP, just above the co-processor at the right side of the board. The pins are, from left to right:
GND, Battery+, Charge output.

You could try using a 3V lithium primary cell, connected to GND and Battery+.
I am currently using a 2-cell NiCd (100mAh) with the negative connection to the GND pin and the positive connection to both Battery+ and Charge output.
This will charge the battery, at a small number of milliamps, when the radio is on.
I did try a "supercap" (5Farad), wired as the NiCd battery above, but it didn't keep the clock going for more than half a day.
A 2-cell NiMh should work as well as a NiCd, 100mAh to 200mAh.

The charge circuit is 3.3 volts through a schottky diode and a 100 ohm resistor. If you wish to try other batteries, make sure this does not provide a charging current that is too high, add more resistance in the charge connection if required.

Suggested loading:
1. Get the new version of the applet, and the file TinyApp.bin.
Tinyapp.zip
(1.13 KiB) Downloaded 306 times
2. Copy the new version of the applet to the appropriate SAM-BA directory ( ???\ATMEL\sam-ba_2.11\tcl_lib\at91sam3s4-9x). You may wish to keep the existing version somewhere safe in case it is needed.
3. Plug in the USB and upload r116 ersky9x binary.
4. Still in SAM-BA, select the co-proc tab.
5. Execute the "Enable co-processor" command.
6. Set the load address to 0x80.
7. Set the name of the file to send to point to the copy of TinyApp.bin on you computer.
8. Click on the "send" button.
9. Disconnect the usb.
10. If required, connect your backup battery.

Switch on the Tx, and navigate to the DATE-TIME menu, set the date/time.
Done!

With the new versions of the applet and TinyApp.bin, you should now be able re-program to co-processor without disconnecting the backup battery.

When the Tx is off, the current drain from the backup battery is less than 10uA, so 100mAh should give you over 400 days of backup time.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
olafnew
Posts: 99
Joined: Thu May 31, 2012 2:52 pm
Country: -
Location: Russia, Moscow
Contact:

Re: ERSKY9X Coding

Post by olafnew »

Mike, thank you!!!
Unfortunately today is a busy day, birthday party for the kids and etc, after i'll finish all the fuzz, next evening i'll revise the rtc installation, and will add a step by step manual into the wiki, hope it will help the less experienced users to install the battery properly.

P.S. i do have a high percision microampermeter(capable of tenths of uA), i'll measure the average standby current as i do the mod.
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: ERSKY9X Coding

Post by MikeB »

I've updated the .tcl file, I had the wrong load address for the co-processor applet. I re-program my board so often, I'm still using a pre-production board with a '3S2 processor on it for most testing, I don't want to wear out the '3S4. The applets load at a different address on the '3S2.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: ERSKY9X Coding

Post by MikeB »

Just added the generic.tcl file update into the main post above, this tells SAM-BA about the co-processor.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Romolo
9x Developer
Posts: 1109
Joined: Sat Dec 31, 2011 12:11 am
Country: -
Location: Massa (MS), Tuscany, Italy

Re: ERSKY9X Coding

Post by Romolo »

Mike coprocessor need to be programmed first with bootloader right ?
So people like me that got first batch of board first need to program the coproc, or am I missing something ?
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: ERSKY9X Coding

Post by MikeB »

Yes, you need the bootloader. I was looking earlier for the instructions for doing that, not sure where they are.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
SkyNorth
Posts: 958
Joined: Tue Dec 27, 2011 11:40 am
Country: -
Location: Mansfield , Ontario

Re: ERSKY9X Coding

Post by SkyNorth »

If you a have a ATMEL AVRISP MKII , then it will program at 3.3V

If you have a cheap EBAY programmer , that only works on 5 Volts then..
You need to power only the Tiny167 - NOT THE WHOLE BOARD .
Use the Battery Backup input , and supply 5V and use the USBAVR programmer.
ERSKY9X-TINY167_WIRE.PDF
(87.67 KiB) Downloaded 335 times
You also need to set the fuses , to allow self programming , and NO divide by 8 on the main clock
Reset set to 1.8V , internal 8Mhz RC clock. ,do not disable the Reset Pin
I'm sorry I dont know the fuse Numbers for this.
This is the Hex file for it.
T167boot.hex
(2.55 KiB) Downloaded 341 times
-Brent
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: ERSKY9X Coding

Post by MikeB »

This is the hex of the bootloader as on the svn repository.
T167boot.hex
(2.64 KiB) Downloaded 337 times
Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Romolo
9x Developer
Posts: 1109
Joined: Sat Dec 31, 2011 12:11 am
Country: -
Location: Massa (MS), Tuscany, Italy

Re: ERSKY9X Coding

Post by Romolo »

May the fuses be: -U lfuse:w:0xe2:m -U hfuse:w:0xde:m -U efuse:w:0xfe:m
I calculated them using: http://www.engbedded.com/fusecalc/
SkyNorth
Posts: 958
Joined: Tue Dec 27, 2011 11:40 am
Country: -
Location: Mansfield , Ontario

Re: ERSKY9X Coding

Post by SkyNorth »

I have been programing from within Bascom AVR
the Fuse settings are FF , E2 , DD , FE
-Brent
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: ERSKY9X Coding

Post by MikeB »

From a test file I produced some time ago:

4. Program the hex file tinyboot.hex into the ATtiny167, Set the fuses to:
EXTENDED 0xFE
HIGH 0xD7
LOW 0xE2

So I disabled the brownout. The RTC app, disables the brownout during sleep anyway so HIGH of D6 (brownout 1.8V) is OK. Might as well save the EEPROM during erase.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Romolo
9x Developer
Posts: 1109
Joined: Sat Dec 31, 2011 12:11 am
Country: -
Location: Massa (MS), Tuscany, Italy

Re: ERSKY9X Coding

Post by Romolo »

done... really happy... I will post here how I did as by default avrdude doesn't know what an attiny167 is :)

I added the lines in the file attached here to my avrdude.conf
I'm lucky enough to have an usbasp programmer able to work at 3.3V, if your one doesn't do not follow this cabling schema, as Mike states you will blow up your ARM processor !!!

As I didn't had a proper connector, I used two parts of female pinhead 7 pin each, I connected the resulting dual in line connector to the radio, usbasp to the PC and then I gave the following command:
avrdude -c usbasp -p attiny167 -P usb -u -U lfuse:w:0xe2:m -U hfuse:w:0xd7:m -U efuse:w:0xfe:m
it failed: so I slowed down speed:

avrdude -c usbasp -p attiny167 -P usb -B 100 -u -U lfuse:w:0xe2:m -U hfuse:w:0xd7:m -U efuse:w:0xfe:m
succeded !!!, I disconnected the programmer and reconnected for flashing

avrdude -c usbasp -p attiny167 -P usb -u -U flash:w:T167boot.hex
worked like a charm !
Attachments
tinyisp2.png
tinyisp.png
avrdude.zip
Avrdude configuration for attiny167
(1.45 KiB) Downloaded 224 times
Last edited by Romolo on Sat Sep 29, 2012 11:54 pm, edited 4 times in total.
iwik
Posts: 115
Joined: Fri Feb 17, 2012 6:08 pm
Country: -
Location: NEW ZEALAND

Re: ERSKY9X Coding

Post by iwik »

Romolo,
Thanks if you could post what you did, makes it easy for someone like me to be able to do it.
Les
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: ERSKY9X Coding

Post by MikeB »

Due to the hiccup in which bootloader is loaded, I've needed to change the co-processor applet to handle both bootloaders.

The updated applet is in this post:
viewtopic.php?f=7&t=40&start=270#p24778

I haven't committed it yet.

If you can update your bootloader please do. The hex file is on the svn repository, and can also be found here:
viewtopic.php?f=7&t=40&start=270#p24932

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Romolo
9x Developer
Posts: 1109
Joined: Sat Dec 31, 2011 12:11 am
Country: -
Location: Massa (MS), Tuscany, Italy

Re: ERSKY9X Coding

Post by Romolo »

Thanks Mike,
I have flashed latest bootloader and the coprocessor applet worked very well, thanks for your hard work.
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: ERSKY9X Coding

Post by MikeB »

If your USBASP won't switch to 3.3V DO NOT connect the 5V output to the 3.3V supply point on the 14 pin header.

THIS WILL BLOW YOUR ARM PROCESSOR.


Connect the 5V connection to the middle pin of the battery backup connector. This will power the Tiny167 from 5V, but leave the rest of the board isolated.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
RCHH
Posts: 467
Joined: Sun Jun 24, 2012 2:48 pm
Country: -
Location: Plymouth

Re: ERSKY9X Coding

Post by RCHH »

RTC clock working perfectly now. Many thanks Mike. :) :)
The simpleton asked "Hows about ErSky9X for Horus???". And the Genius from Dorset replied "Why not indeed? I shall get right onto it!" And then there was light on Horus! And it was good!
Clivew
Posts: 338
Joined: Tue Dec 27, 2011 8:08 pm
Country: -
Location: Stroud, Glos, England

Re: ERSKY9X Coding

Post by Clivew »

Great work Romolo and Mike!
Do you have a link for avrdude please?
I'm guessing you can't do it with burn-o-mat?
Thanks,

Clive
Romolo
9x Developer
Posts: 1109
Joined: Sat Dec 31, 2011 12:11 am
Country: -
Location: Massa (MS), Tuscany, Italy

Re: ERSKY9X Coding

Post by Romolo »

As burn-o-mat is a frontend to avrdude I suppose you already have it installed, furtermore you have avrdude installed in the eepe/companion9x directory as both programs install it.
You only need to edit the config file.
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: ERSKY9X Coding

Post by kaos »

If I understood this correctly, you have to use a USBASP programer to reprogram the Tiny 1st for the RTC to work? or can you do all this through c9X?
Clivew
Posts: 338
Joined: Tue Dec 27, 2011 8:08 pm
Country: -
Location: Stroud, Glos, England

Re: ERSKY9X Coding

Post by Clivew »

Romolo wrote:As burn-o-mat is a frontend to avrdude I suppose you already have it installed, furtermore you have avrdude installed in the eepe/companion9x directory as both programs install it.
You only need to edit the config file.
I tried to do that in windows (xp) and dos, (well xp version of it).No luck so far sadly.
Most likely me being stupid!


Clive
Romolo
9x Developer
Posts: 1109
Joined: Sat Dec 31, 2011 12:11 am
Country: -
Location: Massa (MS), Tuscany, Italy

Re: ERSKY9X Coding

Post by Romolo »

kaos wrote:If I understood this correctly, you have to use a USBASP programer to reprogram the Tiny 1st for the RTC to work? or can you do all this through c9X?
to update/first install of the bootloader only by hand
to load the tinyapp you will use samba,

in a future if the coproc app will change often we will include updating it in c9x

@clive, which is the error ?
SkyNorth
Posts: 958
Joined: Tue Dec 27, 2011 11:40 am
Country: -
Location: Mansfield , Ontario

Re: ERSKY9X Coding

Post by SkyNorth »

ONLY THE BETA BOARDS WERE NOT PROGRAMMED.
If the Co-processor STATUS shows 0101 ... then it IS programmed with a bootloader.

-Brent
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: ERSKY9X Coding

Post by MikeB »

Once you have a bootloader we can probably update it by loading a special TinyApp that contains a new version of the bootloader and the code to update it. This Tiny device does not have a proteced boot area so a loaded app can overwite it.

Mike.

Edit, Actually, if the Co-processor status shows 0181, you have a bootloader, if it shows 0101 or 0102, then you have a bootloader and an application, with the application running.
Specifically, the 01 at the beginning is a status byte from the interface hardware driver, and the second byte is the version of the item currently running, 0x80 + version for a bootloader, just version for an application.
Version 01 of the application just runs and returns the version number!
Version 02 of the application implements the RTC.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

Post Reply

Return to “erskyTx (was ersky9x)”