Page 4 of 4

Re: flashing latest er9x

Posted: Mon Dec 28, 2015 9:20 pm
by JanRy
Hi everyone,
I've built a M128 board from scratch using serial LCD (http://www.hobbyking.com/hobbyking/stor ... K2_1_.html) with 'Multiprotocol TX' and having problem compiling MBTx to use left vertical trims as per original board (voice module NOT installed).The obvious 'fix' is to use PC0/PC4 for the trim inputs, however PC4 is already used for serial LCD clock line.
Can anyone point me to a compiling options file? Any help appreciated.

Re: flashing latest er9x

Posted: Mon Dec 28, 2015 9:39 pm
by MikeB
If you are getting a file mbtx.hex, then you are compiling for er9x V2. This is still in development, better, for now, to compile V1.
I suggest you do a "make clean", then do "make CPU=128 EXT=FRSKY". You may need to add extra options to get the serial LCD, I'm not sure what as I didn't add that code.This will build the standard er9x for the M128 processor.
If you don't have a voice module, then simply don't set the "Sound Mode" to "Megasound" (AudioHaptic menu), and make sure "M'Sound Serial" is set to OFF in the hardware menu. Then the left vertical trims work as per the original hardware.
Note that recent code disables the hardware menu by default. To enable it just hold the left horizontal trim to the left as you power on.

Mike.

Re: flashing latest er9x

Posted: Tue Dec 29, 2015 3:30 am
by JanRy
Mike,
I could not enable hardware menu on the radio by holding left trim to the left during power-up, but I could disable MegaSoundSerial in eePe and after re-flashing the EEPROM the trims work as expected.
Thanks again

Re: flashing latest er9x

Posted: Tue Dec 29, 2015 12:35 pm
by MikeB
I assume you downloaded the source code from Github. Did you download from the "master" branch or the "next" branch?

Mike.

Re: flashing latest er9x

Posted: Tue Dec 29, 2015 9:44 pm
by JanRy
yes, I have downloaded both master and next from Github. I've compiled and tested both. Neither has offered the hardware menu (or better, I could not find it in the radio setup menus). I have previously "Set fuses to protect EEprom" in eePe, perhaps that is the reason for the behavior.

Re: flashing latest er9x

Posted: Tue Dec 29, 2015 11:31 pm
by MikeB
The hardware menu isn't in the M64-FrSky version due to lack of flash space. It should be in the '128 and '2561 versions.

Mike.

Re: flashing latest er9x

Posted: Wed Dec 30, 2015 12:01 am
by JanRy
I am using and have compiled M128 version. Where does the hardware menu appear?

Re: flashing latest er9x

Posted: Wed Dec 30, 2015 12:04 am
by jhsa
Turn the radio ON while holding both horizontal trims away from each other. The hardware menu should now appear in the radio setup index..

João

Re: flashing latest er9x

Posted: Wed Dec 30, 2015 12:28 am
by JanRy
Thanks João, it works now.

Re: flashing latest er9x

Posted: Wed Dec 30, 2015 12:36 am
by jhsa
;)

Re: flashing latest er9x

Posted: Wed Dec 30, 2015 4:10 am
by flybabo
JanRy wrote:Hi everyone,
I've built a M128 board from scratch using serial LCD (http://www.hobbyking.com/hobbyking/stor ... K2_1_.html) with 'Multiprotocol TX' and having problem compiling MBTx to use left vertical trims as per original board (voice module NOT installed).The obvious 'fix' is to use PC0/PC4 for the trim inputs, however PC4 is already used for serial LCD clock line.
Can anyone point me to a compiling options file? Any help appreciated.
As I wrote the serial LCD driver on er9x and I realized this problem for the serial LCD users.
Actually, LV trim can be rerouted to PC0/PC1 since LCD CS can be permanently tied to GND by removing 5K resistor in 5V-3.3V logic level translator just like PC4 (LCD WR).
But you need modified versions of 'lcd.cpp' and 'driver.cpp'.
I have a working version of 'lcd.cpp' with updated serial LCD code and plz PM me if you're interested in.

Re: flashing latest er9x

Posted: Wed Dec 30, 2015 5:51 am
by JanRy
Hi flybabo,
thanks for writing serial LCD library. It made my project possible (re-using DX4e shell). I am happy with the outcome, since I've had no room for a sound module anyway. All is working now.
I am not entirely sure if CS can be left tied to the ground permanently. According to the data sheet: "Chip Select Input .... in case of serial interface, the internal shift register and the counter are reset."
I've had a minor issue with my KK2 LCD. It would not initialise on power-up, but when power was re-applied within 2sec, it would. So I've added a delay of about 30us holding RES high in lcd_init (2 places) and that fixed my issue.

Re: flashing latest er9x

Posted: Wed Dec 30, 2015 9:14 am
by flybabo
I think CS can be tied down even for the serial LCD since reset pulse will reset internal shift register and counter after power up.
Once these registers are reset, it is followed by a series of legitimate data transfers and it doesn't need to reset those registers again.
Since entire LCD data lines (PA0-PA7) are not used for a serial LCD, I better to add PA6/PA7 as LV trim rerouting option for serial LCD users to allow them to use the second UART ports for the serial voice card or multi-protocol module.
I also looked into the LCD code and lcd_init() generates 2us reset-low pulse and 1.5ms recovery time with reset-high before starting to set control bits.
Did you put 30us delay before generating 2us reset-low pulse?

Re: flashing latest er9x

Posted: Thu Jan 07, 2016 6:57 am
by flybabo
I just verified that both serial and parallel LCD code work with permanently tied down CS pin.
Since PC4 is used as SCLK in the serial LCD interface, I'll assign PC0/PC1 for "on-board" LV trim rerouting option to relieve the serial port in upcoming er9x-v2 firmware. Note that current er9x-v2 test version assigned PC0/PC4.
That means PC4 is always available for other application.

Re: flashing latest er9x

Posted: Thu Jan 07, 2016 8:10 am
by JanRy
flybabo,
that's a very good news :D . I'll check with my KK2 LCD too.
I've added crudely 30us delay just before the reset pulse (@ approx line 910 & line 1000):
"
LcdLock = 1 ; // Lock LCD data lines

PORTC_LCD_CTRL |= (1<<OUT_C_LCD_RES);
delay_1_5us(30000);

PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_RES); //LCD_RES
"

Re: flashing latest er9x

Posted: Thu Jan 07, 2016 9:39 am
by flybabo
You'd added 30ms delay not 30us delay :)
Does KK2 LCD have a power-on-reset circuitry?

Re: flashing latest er9x

Posted: Thu Jan 07, 2016 10:27 pm
by JanRy
yes, you are right, it is 30ms! When testing, it required minimum of 10ms, so I've added 30ms. Still a very short delay on power up.
The data sheet for KK2 lcd that I found doesn't mention power-on-reset circuitry.