HobbyKing.com New Products Flash Sale
Reply
Thread Tools
Old Feb 11, 2013, 12:50 PM
RC beginner
New York
Joined Oct 2008
6,054 Posts
jake, im going to reply in the avr rx thread where it is far more on topic then cluttering up this one.
dave1993 is offline Find More Posts by dave1993
Reply With Quote
Sign up now
to remove ads between posts
Old Feb 11, 2013, 12:50 PM
Registered User
Joined Dec 2012
28 Posts
Hi,

I'm back... I havn't time to work on the RX until now. I'm programming on C and I do not understand ASM. .. Shame to me...

I don't know if you remember, but my TX ID is 0x56220000 so 00 00 22 56. I looked to the phracturedblue table in is post #43 : my sequence should be :

0x0a 0x5a 0x14 0x64 0x1e 0x6e 0x28 0x78 0x32 0x82 0x3c 0x8c 0x46 0x96 0x50 0xa0

But, when I look to SPI wire channel are (not in order) :

0x04 0x54 0x18 0x68 0x9A 0x4A

So, there are not number which match with a number in the sequence. I noticed Dave said that its Tx doesn't match any sequence. Have you an idea why?

Thanks,
Surfbreizh is offline Find More Posts by Surfbreizh
Reply With Quote
Old Feb 11, 2013, 02:37 PM
RC beginner
New York
Joined Oct 2008
6,054 Posts
i don think the sequence you predict is correct. should be row 0 and subtract 1 from each value i think. according to my revised understanding of the protocol yours is not a "problem id" and should adhere to pbs description. no matter what the bytes you see are not correct so its a mystery.

maybe recheck your id and finish your incomplete sequence on both working tx and again on a linked rx to be sure.
dave1993 is offline Find More Posts by dave1993
Reply With Quote
Old Feb 12, 2013, 03:35 PM
Registered User
Joined Dec 2012
28 Posts
Hi,

Today, I read my sequence :

0E 5E 4A 9A 22 72 04 54 18 68 36 86 2C 7C 40 90 0E

It does match with my previous analysis. I have not check my ID again but I assume it was good as well. In several sample, ID was exacly the same. Any Idea?
Surfbreizh is offline Find More Posts by Surfbreizh
Reply With Quote
Old Feb 13, 2013, 03:49 AM
Registered User
France, Alsace, Strasbourg
Joined Dec 2012
77 Posts
Are you sure you did not invert high byte - low byte in your id ?
because it seems to work if we say that low byte is 0x56:
7th line = 0x50 0xa0 0x28 0x78 0x0a 0x5a 0x1e 0x6e 0x3c 0x8c 0x32 0x82 0x46 0x96 0x14 0x64 0x50
- 5 (high nibble) - 1(rx = tx -1)
= 0x4A 0x9A 0x22 0x72 0x04 0x54 ...

generally, when you wrote numbers most significant digit is at left (even in arabic). The fact that in ic memory it comes first or last is an other issue...
ThierryRC is offline Find More Posts by ThierryRC
Reply With Quote
Old Feb 13, 2013, 04:01 AM
Registered User
France, Alsace, Strasbourg
Joined Dec 2012
77 Posts
Quote:
Originally Posted by midelic View Post
Thierry,
Why do you use 2 sets of data and different registers ,.....input pulse values and output pulse values for the same ppm input data values?
Well, i use different registers for input/output because (tx code, but also for rx...) input are updated in interrupt and output are send in mainloop. pulse duration is 16bit long so you have to send high byte then low byte (or reverse, I don't remember). If between you have an interrupt modifying high or/and low byte then it could be a problem...
So before updating tx packet, I copy input -> output with 2 lines assembler:
movff ipxh, opx
movff ipxl, opxl
but if you look carefully I disable interrupt just before and enable interrupt just after these two instructions
ThierryRC is offline Find More Posts by ThierryRC
Last edited by ThierryRC; Feb 13, 2013 at 04:08 AM.
Reply With Quote
Old Feb 13, 2013, 06:12 AM
Registered User
Joined Dec 2012
28 Posts
Thank you Thierry.

I read a frame in chronological order and it gave me that :

40 18
45 55 56 22 00 00 00 06 D8 07 4C 06 FC 05 F5 03 02 06 01 06 01 06
A
F
0F 4A
C

I guess, ID must be transmitted in Little Endian. Thanks again !
Surfbreizh is offline Find More Posts by Surfbreizh
Reply With Quote
Old Feb 13, 2013, 06:21 AM
Registered User
midelic's Avatar
Joined Apr 2012
3,728 Posts
Well I wrote the PPM input code without interrupts I have 2 register inh(high byte) and inl(for low byte).I don't know how to use only 2 registers for sending channels data ,I don't want to use 16 registers for that.In my avr all registers are 32.
midelic is online now Find More Posts by midelic
RCG Plus Member
Last edited by midelic; Feb 13, 2013 at 07:05 AM.
Reply With Quote
Old Feb 13, 2013, 08:11 AM
Registered User
France, Alsace, Strasbourg
Joined Dec 2012
77 Posts
Quote:
Originally Posted by midelic View Post
Well I wrote the PPM input code without interrupts I have 2 register inh(high byte) and inl(for low byte).I don't know how to use only 2 registers for sending channels data ,I don't want to use 16 registers for that.In my avr all registers are 32.
You have 32 "working registers" with avr (with pic you have only 1: "Wreg" !) but you have plenty of space in ram for variables(I think 1Ko for atmega8). Don't use Working registers to store variables values but temporary values for "working" (compute, do logical functions, ...)
So you just need to declare enougth variables in ram just like I do.
look for keywords: "indirect address register pointers" in avr docu
ThierryRC is offline Find More Posts by ThierryRC
Reply With Quote
Old Feb 13, 2013, 08:52 AM
Registered User
midelic's Avatar
Joined Apr 2012
3,728 Posts
The avr doesn't support variable declaration.There are registers for that.I used registers pointers for reading the control registers table/channels table.Now I need to find out the opposite writing in SRAM using register pointers.
midelic is online now Find More Posts by midelic
RCG Plus Member
Last edited by midelic; Feb 13, 2013 at 09:02 AM.
Reply With Quote
Old Feb 13, 2013, 11:12 AM
RC beginner
New York
Joined Oct 2008
6,054 Posts
actually even the old version of avrasm i use provides ram variable and array labeling via the .equ directive. unlike the define you are fond of which is only useful for registers. however generally one only needs to label the first location in ram and offset from there.
dave1993 is offline Find More Posts by dave1993
Reply With Quote
Old Feb 13, 2013, 11:22 AM
Registered User
midelic's Avatar
Joined Apr 2012
3,728 Posts
I just starting thinking something similar.
The SRam adress starts on 0x60.Label that adress for the beginning and ST store indirect to SRAM data in a loop incrementing the adress.Actually the same loop from decoding the PPM signal , ICR1H and ICR1L data . Retrieving data with Z pointers.
I'm still trying to understand this one.
With my limited understanding of asm directives "equ" is used for labeling constants not variables.Is not better use "byte" directive reserving one byte in Sram for a variable?
midelic is online now Find More Posts by midelic
RCG Plus Member
Last edited by midelic; Feb 13, 2013 at 04:33 PM.
Reply With Quote
Old Feb 13, 2013, 05:47 PM
Registered User
midelic's Avatar
Joined Apr 2012
3,728 Posts
Thierry ,
Your servo data is writen to flash memory not eeprom ....right?
midelic is online now Find More Posts by midelic
RCG Plus Member
Last edited by midelic; Feb 13, 2013 at 06:44 PM.
Reply With Quote
Old Feb 14, 2013, 06:23 AM
Registered User
France, Alsace, Strasbourg
Joined Dec 2012
77 Posts
Quote:
Originally Posted by midelic View Post
Thierry ,
Your servo data is writen to flash memory not eeprom ....right?
"servo data" is writen in ram (or sram, the same, 1Kbyte for atmega8) memory

"flash memory" (8kbyte for atmega8) is where you find your "assembler program". Normaly, you don't have to write to it unless you want to write a "bootloader" program (enables to download a new program trough rs232 link at boot, so avr reprograms itself !) or to store data table (in our application it could be "frequency sequence table" as example)

"eeprom memory"(512byte for atmega8) is for storing data between 2 start-up (perfect for storing tx previous bind ID). could also store "frequency sequence table"
ThierryRC is offline Find More Posts by ThierryRC
Last edited by ThierryRC; Feb 15, 2013 at 04:05 PM.
Reply With Quote
Old Feb 14, 2013, 07:01 AM
Registered User
midelic's Avatar
Joined Apr 2012
3,728 Posts
I think is a confusion.I'm talking about TX not Rx .In Rx eeprom is needed to store previous bind ID otherwise you'll have to bind every time you use you radio.And the frequency and control reg. table are in flash memory.
In your tx code I see no data stored in eeprom.I see only the eeprom read write subroutines and variable declarations....nothing else.I think is from RX code.
midelic is online now Find More Posts by midelic
RCG Plus Member
Last edited by midelic; Feb 14, 2013 at 07:11 AM.
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion Benefits of buying FlySky TH9x (v2) over Turnigy 9x (v2) wwfisher Radios 64 Oct 10, 2014 06:37 PM
Question 9X - FlySky/iMax/Turnigy/Eurgle FOR DUMMIES aeajr Radios 1007 Sep 22, 2014 04:09 AM
Found turnigy 9x/flysky 9x wanted!!! kremecheze Aircraft - General - Radio Equipment (FS/W) 2 Mar 25, 2012 04:04 PM
Wanted ER9x or Turnigy/Flysky 9x daign FPV Equipment (FS/W) 0 Mar 22, 2012 06:21 PM
Found Turnigy/FlySky/Eurkle/etc 9X Shell flyandi Aircraft - General - Radio Equipment (FS/W) 0 Mar 11, 2012 06:12 PM