Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
User8734
Level 4
Level 4
Good day,

I just want to share my experience working with this indicator & XMC4500 Relax Lite Kit-V1

Used standard SPI001 application from DAVE

1. HW issues:
- Operaation Mode: Stadart Full Duplex SPI //Each clock shift bit in both Rx/Tx FIFO
- Baud Rate 8MHz
- Transmit/Receive MSB first
- Delay Clock on 1/2 period // Rising Edge - Strobing data; Falling Edge - Shifting
- Clock polarity: No inversion // Initial State of CLK line - 0
- Word Length 8
- Frame Length 64 //Means indefinite length; if set 8 here - each 8 bit /CS will go high, bracking frame

- FIFO buffers Rx/Tx 8/8
- Pad Class: A2 Strong Driver, Medium Edge

Here shall be noted that XMC4500 support only 10MHz speed; same time FT800 - 30MHz.

2. As reference, taken AN's 240 & 312, see attach.

3. Writing is actually not big problem: you shall enshure that Tx FIFO empty first,
and then fill it with appropriate data.

Send command function:

void ft800cmdWrite(unsigned char ftCommand)
{
unsigned char cZero = 0x00; // Filler value for command
unsigned char ftData8;

SPI001_WriteData(&SPI001_Handle0, &ftCommand, SPI001_STANDARD); //Send Command
SPI001_WriteData(&SPI001_Handle0, &cZero, SPI001_STANDARD); //Send Filler Byte
SPI001_WriteData(&SPI001_Handle0, &cZero, SPI001_STANDARD); //Send Filler Byte

uS_Delay(3); //Wait 3uS to empty TX buffer; @8MHz each byte send by 1microSec

}

Write byte in memory:

void ft800memWrite8(unsigned long ftAddress, unsigned char ftData8)
{
unsigned char cTempAddr[3]; // FT800 Memory Address

cTempAddr[2] = (char) (ftAddress >> 16) | MEM_WRITE; // Compose the command and address to send
cTempAddr[1] = (char) (ftAddress >> 8); // middle byte
cTempAddr[0] = (char) (ftAddress); // low byte

SPI001_WriteData(&SPI001_Handle0, &cTempAddr[2], SPI001_STANDARD);
SPI001_WriteData(&SPI001_Handle0, &cTempAddr[1], SPI001_STANDARD);
SPI001_WriteData(&SPI001_Handle0, &cTempAddr[0], SPI001_STANDARD);

SPI001_WriteData(&SPI001_Handle0, &ftData8, SPI001_STANDARD);

uS_Delay(4); //Wait 4uS to empty TX buffer

}

Read word from memory:

unsigned int ft800memRead16(unsigned long ftAddress)
{
// unsigned char ftData8;
unsigned int ftData16; // 16-bits to return
unsigned char cTempAddr[3]; // FT800 Memory Address
unsigned char cTempData[6]; // Place-holder for 16-bits being read
unsigned char cZeroFill = ZERO;

cTempAddr[2] = (char) (ftAddress >> 16) | MEM_READ; // Compose the command and address to send
cTempAddr[1] = (char) (ftAddress >> 8); // middle byte
cTempAddr[0] = (char) (ftAddress); // low byte

SPI001_WriteData(&SPI001_Handle0, &cTempAddr[2], SPI001_STANDARD);
SPI001_WriteData(&SPI001_Handle0, &cTempAddr[1], SPI001_STANDARD);
SPI001_WriteData(&SPI001_Handle0, &cTempAddr[0], SPI001_STANDARD);

SPI001_WriteData(&SPI001_Handle0, &cZeroFill, SPI001_STANDARD); // Send dummy byte, after it each sended byte responded with data

SPI001_WriteData(&SPI001_Handle0, &cZeroFill, SPI001_STANDARD); //To get back word of data sending two byte respectively
SPI001_WriteData(&SPI001_Handle0, &cZeroFill, SPI001_STANDARD);

uS_Delay(6); //Wait to empty Tx FIFO buffer and as well fill Rx FIFO

SPI001_ReadData(&SPI001_Handle0, &cTempData[0]);
SPI001_ReadData(&SPI001_Handle0, &cTempData[1]);
SPI001_ReadData(&SPI001_Handle0, &cTempData[2]);
SPI001_ReadData(&SPI001_Handle0, &cTempData[3]);
SPI001_ReadData(&SPI001_Handle0, &cTempData[4]);
SPI001_ReadData(&SPI001_Handle0, &cTempData[5]);

ftData16 = (cTempData[5]<< 😎 | // Compose value to return - high byte
(cTempData[4]); // low byte

return ftData16; // Return 16-bits

}

Here shall be noted, that before reading you must enshure, that Rx FIFO is empty,
and read data from it if not. (This is because each sended byte on SPI produced received byte in Rx FIFO with no practical meaning).
Using one variable instead of array elements TempData[0]..TempData[3] make code non-working (I suppose due for some optimisation).
Same result I get when trying use "for" cycle in functions as it done in AN_312 example.

Functions for different data length done by similar way.

4. FT800.h in AN_312.zip contains registers definitions.

Noted that in it incorrectly defined:
#define DL_VERTEX2II 0x02000000UL // requires OR'd arguments
Correct:
#define DL_VERTEX2II 0x80000000UL // requires OR'd arguments
Please refer to "FT800_Programmer_Guide".

5. According VM800B50A-BK DS, it is operated from +5V only.
But it's core working from +3.3V, and two voltage converters used:
- linear one AP1117-3.3
- switching one on MIC2289 (max voltage 10V) // for backlight

So I powered VM800B50A successfully from +4V ... +8V in operating state.
Current consumption decreasing when voltage increasing. Say @4V it consume 200mA,
when @8V around 100mA only.

Such mode not specified by vendor, so long-term use voltages different from +5V is still under question.

BR
K
0 Likes
0 Replies