FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  

News:

Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support


New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Show Posts

You can view here all posts made by this member. Note that you can only see posts made in areas to which you currently have access.

Topics - LOstrander

Pages: [1]
1
Discussion - Software / Using MM900EV-LITE as SPI Slave
« on: June 20, 2019, 04:15:18 PM »
I have a touchscreen and controller that I'm using as an HMI in a larger system.  I want to use the MM900EV-LITE as a SPI Slave to send some data from the touchscreen to the main controller.  For some reason, whenever I try to write to the SPI_DATA register, the controller resets.

I'm using the exact same code as the example from the FT9xx Toolchain for a SPI Slave.

Code: [Select]
#include "GoButton.h"
#include "FT_Platform.h"
#include "FT_ESD.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ff.h"
#include "FT_Platform_FT900.h"

#ifndef ESD_SIMULATION
#include "ft900.h"
#include "ft900_spi.h"
#endif

ESD_FUNCTION(GoButton_SendData)
ESD_PARAMETER(fptr, Type = int)
void GoButton_SendData(fptr)
{
#ifndef ESD_SIMULATION
#define APP_BUFFER_SIZE (8)

#define SPIS_FIFOSIZE (64)

uint8_t* spis_dev_buffer;
uint8_t spis_dev_buffer_size;
uint8_t spis_dev_buffer_ptr;

    // Enable the SPI Slave device...
    sys_enable(sys_device_spi_slave0);

    // Set GPIO36 to SPIS0_CLK, GPIO37 to SPIS0_SS, GPIO38 to SPIS0_MOSI and GPIO39 to SPIS0_MISO...
    gpio_function(36, pad_spis0_clk);
    gpio_function(37, pad_spis0_ss);
    gpio_function(38, pad_spis0_mosi);
    gpio_function(39, pad_spis0_miso);

gpio_function(66, pad_gpio66);

    // Configure directions for the SPI slave 0 pins
    gpio_dir(36, pad_dir_input);
    gpio_dir(37, pad_dir_input);
    gpio_dir(38, pad_dir_input);
    gpio_dir(39, pad_dir_output);

gpio_dir(66, pad_dir_output);
gpio_pull(66, pad_pull_none);

    // Enable the SPI Slave Device...
    spi_init(
        SPIS0,          // Device
        spi_dir_slave,  // Direction
        spi_mode_0,     // SPI mode
        4);             // Ignored

    // Enable the FIFOs on the SPI Slave...
    spi_option(SPIS0, spi_option_fifo, 1);
spi_option(SPIS0,spi_option_fifo_size,SPIS_FIFOSIZE);
spi_option(SPIS0,spi_option_fifo_receive_trigger,1);

// Global variables initialization
//    spis_dev_buffer = buffer;
    spis_dev_buffer_size = APP_BUFFER_SIZE;
    spis_dev_buffer_ptr = 0;

    ...

//Setup data for transfer
uint8_t SendBuf[8] = {Diameter, Angle, Base >> 8, Base & 0xFF, Nose >> 8, Nose & 0xFF, Amount, Interval};
spis_dev_buffer = SendBuf;

//Load first byte
SPIS0->SPI_DATA = spis_dev_buffer[0];

//Tell the MCU to start transfering
gpio_write(66, 1);

//Wait for the Slave Select to go low
do{
asm_noop();
}
while(gpio_read(37) == true);

    // Load the SPIS0 buffer...
for(i=1;i<APP_BUFFER_SIZE;i++)
{
SPIS0->SPI_DATA = spis_dev_buffer[i];
}

//Make sure "Go button" is reset
gpio_write(66, 0);
#endif

}

From what I can tell, I'm not doing anything different besides leaving out the UART and looping functions from the example.  Is there something I missed?  or a file I need to include?

2
Discussion - Software / Manipulating SD Files with ESD
« on: April 22, 2019, 04:27:41 PM »
I have been trying to incorporate a couple of functions into my ESD program to read and write a few text files from an SD card.

First I tried using the fopen() functions native to C.  The program compiled and ran, but when I went to check the SD card's contents, the files were nowhere to be found.

Next I tired using the FatF header included in the SD card example in the Ft9XX Toolchain.  I changed the functions over to the FatF commands, and included all of the files required in my ESD project.

For some reason, however, it refuses to recognize the typedefs for the various functions within the header (specifically the DSTATUS and DRESULT types in diskio.h), and claims a few variables/enums were undeclared because of this.

So my question is kind of two-fold:  Is there an easy way to communicate with the SD card on the FT900 through ESD for non-bitmap files, and if it involves the ff.h header, what do I change to make it function?

For reference, I'm using the ME812A WH50R and MM900EV-LITE in ESD 4.5.

3
Discussion - Software / A few questions about functions in ESD 4.5
« on: April 08, 2019, 07:51:43 PM »
I am trying to design a program in Eve Screen Designer 4.5 to act as the HMI for a larger machine.  In have the basic GUI laid out to where I can navigate screens and the like.  The issue I'm running into now is performing actions in the background based on user input.

I guess the main question I have is how the functions interact with the rest of the system "flow."  If they don't have a call, do they just run continuously on the page, or only when the page is first activated?  Can variables persist across several pages, or are they "destroyed" when you leave the page they were created in?

I've looked at some of the example programs, but I'm not exactly following what's going on in them.

There are 3 major things I'd like the HMI to do when commanded:

1. Keep track of what language was selected by the user and display the corresponding text on each page (i.e. HOME in English and ZUHAUSE in German).  Preferably based on which button was pressed on the User Settings page.

2. Display text based on the contents of a text file.  Essentially, each time the user presses a left or right arrow, display the correct string of text in a label on the screen.  (I have a fairly good understanding of how to implement this, but again, would like it to persist across several pages)

3. Send/Receive data over SPI and perform a couple of functions (namely sending the new program info to the other controller and displaying any error messages received from it).

One other minor question is implementing a keyboard on the screen.  I saw an example program for the FT900 toolchain that creates a keyboard.  Can this be used in ESD?  For example, if I put it in the same folder and #include it in the function file, can it be called and displayed in the program?

For reference, we are using the ME812A WH50R screen and the MM900EV-LITE board in this setup.

Pages: [1]