FTDI Community

General Category => Discussion - Software => Topic started by: uTasker on October 01, 2019, 09:25:32 PM

Title: Dual FT813 emulation
Post by: uTasker on October 01, 2019, 09:25:32 PM
Hi

We have used the FT8xx emulation for a number of product developments but now have a new design that uses two FT813s.
Is it possible to use the emulation for two LCDs at the same time? Presently it looks like it can only support being started a single time and the interface routines have no reference to a particular instance (which would presumably be necessary to allow it).

Any possibility?

Regards

Mark
Title: Re: Dual FT813 emulation
Post by: FTDI Community on October 02, 2019, 03:18:48 PM
Hello,

Unfortunately it is not possible at this time to emulate two LCDs concurrently.
But I will pass this on to the development team for their consideration.

Best Regards,
FTDI Community.
Title: Re: Dual FT813 emulation
Post by: uTasker on October 02, 2019, 04:10:42 PM
Hi

I have just switched to the BT8XXX emulator (from FT8XXX) and it supports "emulator" instances it seems.
I can create two threads, each with its own screen being displayed.

Eg.
Code: [Select]
__declspec(dllimport) extern unsigned char (*FT8XXEMU_transfer)(unsigned char data);becomes
Code: [Select]
__declspec(dllimport) extern unsigned char BT8XXEMU_transfer(BT8XXEMU_Emulator *emulator, unsigned char data);
so it may be possible to control two by passing the appropriate
Code: [Select]
BT8XXEMU_Emulator pointer on each operation.

Presently I haven't been able to use the BT8XXX successfully for a single screen (it doesn't return 0x7c when the ID is requested - it returns 0x00 instead) whereby the FT8XXX version operates. However if I can solve that issue I will be able to see whether dual displays maybe operates....

Regards

Mark
Title: Re: Dual FT813 emulation
Post by: FTDI Community on October 04, 2019, 10:08:52 AM
Hello,

So the development team have informed me that it is actually possible to emulate two screens at once.

They have provided the below initialization code:

Code: [Select]
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                            BT8XXEMU_EmulatorParameters params;
                            BT8XXEMU_defaults(BT8XXEMU_VERSION_API, &params,
#if defined(BT815EMU_MODE)
                                            BT8XXEMU_EmulatorBT815
#elif defined(FT810EMU_MODE)
                                            BT8XXEMU_EmulatorFT810
#else
                                            BT8XXEMU_EmulatorFT801
#endif
                            );

                            params.Flags =
                                            BT8XXEMU_EmulatorEnableKeyboard
                                            | BT8XXEMU_EmulatorEnableMouse
                                            | BT8XXEMU_EmulatorEnableAudio
                                            | BT8XXEMU_EmulatorEnableDebugShortkeys
                                            | BT8XXEMU_EmulatorEnableCoprocessor
                                            | BT8XXEMU_EmulatorEnableGraphicsMultithread
                                            | BT8XXEMU_EmulatorEnableStdOut
                                            | BT8XXEMU_EmulatorEnableMainPerformance
                                            ;
                            params.UserContext = this;

#if defined(BT815EMU_MODE)
                            params.Flash = flash;
#endif

                            BT8XXEMU_run(BT8XXEMU_VERSION_API, &emulator, &params);
                           
++++++++++++++++++++++++++++++++++++++++++++++++++++++++

     More code to implement the read/write EVE by passing the pointers of different instances:


                void swrbegin(size_t address)
                {
                                BT8XXEMU_chipSelect(emulator, 1);

                                BT8XXEMU_transfer(emulator, (2 << 6) | ((address >> 16) & 0x3F));
                                BT8XXEMU_transfer(emulator, (address >> 8) & 0xFF);
                                BT8XXEMU_transfer(emulator, address & 0xFF);
                                // BT8XXEMU_transfer(0x00);
                }

                void swr8(uint8_t value)
                {
                                BT8XXEMU_transfer(emulator, value);
                }

                void swr16(uint16_t value)
                {
                                BT8XXEMU_transfer(emulator, value & 0xFF);
                                BT8XXEMU_transfer(emulator, (value >> 8) & 0xFF);
                }

                void swr32(uint32_t value)
                {
                                BT8XXEMU_transfer(emulator, value & 0xFF);
                                BT8XXEMU_transfer(emulator, (value >> 8) & 0xFF);
                                BT8XXEMU_transfer(emulator, (value >> 16) & 0xFF);
                                BT8XXEMU_transfer(emulator, (value >> 24) & 0xFF);
                }

                void swrend()
                {
                                BT8XXEMU_chipSelect(emulator, 0);
                }

                void wr32(size_t address, uint32_t value)
                {
                                swrbegin(address);
                                swr32(value);
                                swrend();
                }

                uint32_t rd32(size_t address)
                {
                                BT8XXEMU_chipSelect(emulator, 1);

                                BT8XXEMU_transfer(emulator, (address >> 16) & 0x3F);
                                BT8XXEMU_transfer(emulator, (address >> 8) & 0xFF);
                                BT8XXEMU_transfer(emulator, address & 0xFF);
                                BT8XXEMU_transfer(emulator, 0x00);

                                uint32_t value;
                                value = BT8XXEMU_transfer(emulator, 0);
                                value |= BT8XXEMU_transfer(emulator, 0) << 8;
                                value |= BT8XXEMU_transfer(emulator, 0) << 16;
                                value |= BT8XXEMU_transfer(emulator, 0) << 24;

                                BT8XXEMU_chipSelect(emulator, 0);
                                return value;
                }                             

Best Regards,
FTDI Community
Title: Re: Dual FT813 emulation
Post by: uTasker on October 04, 2019, 04:25:06 PM
Hi

Thanks - I think that basic operation is OK with dual-screens:

https://youtu.be/xsctoGQPgh4

Here I show the uTasker project simulating a Kinetis FRDM-K22F board connected to two emulated BF800s via SPI. All tx data is sent out to both so that both display the same things but the calibration pages show that each instance is really independent.
So I think the product development work can indeed being (using Bridgetek library for first time)!

Regards

Mark



Complete Kinetis solutions for professional needs, training and support: http://www.utasker.com/kinetis.html

uTasker: supporting >1'000 registered Kinetis users get products faster and cheaper to market

Open Source version at https://github.com/uTasker/uTasker-Kinetis


Title: Re: Dual FT813 emulation
Post by: FTDI Community on October 07, 2019, 01:49:27 PM
Hello,

Thanks for sharing!

Best Regards,
FTDI Community