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.

Messages - scorpioprise

Pages: [1] 2
1
Discussion - Software / FT900 SPI read library error
« on: November 27, 2019, 11:53:51 AM »
Hi everybody,
I have to admit my ignorance, but I asked more experts and I had the following solution.

I was using an external ADC as slave, that was sending me back wrong / corrupted packets.

The Library given (2.5.0) for spi has a bug in spi_readn(), that is the
Code: [Select]
uint8_t FifoScratch[64] variable is not initialized to zero.
Thus, when reading from spi, this leads to a spurious writes where there should be none and, as in my case, the slave recives data when not supposed, sometimes leading to erratic behaviour.
Simple solution, add to the original code, just after the declaration, a 
Code: [Select]

for (int j = 0; j < 64; j++) {
FifoScratch[j] = 0x00;
}
or whatever you like.

Hope this helps future users.

2
Seems to me you had the same problem I had...
I wish that reading http://www.ftdicommunity.com/index.php?topic=146.msg541#msg541 shall help you.
That's the "hack" I used  ;)
Cheers

3
Discussion - Software / Errors about crt0.S
« on: June 26, 2019, 09:21:52 AM »
Hi everyone,
I'm experiencing some troubles against AN415 (Ethernet to GPIO), because after some few modifications (moved some headers, removed some debug messages, changed project name), I could not compile it anymore, and I've hit a series of errors "multiple definition of" ( i.e. "_exit","_start","_exithook") that hit in crt0.S.

I don't understand why, as I've made no change neither in main nor in crt0, adding that particular defines.

Searching into the code, I have a reference to crt0 in comments

Code: [Select]
void flash_config_init() {

[..cut..]// Project settings incorrect. Require dlog support with modified
// linker script and crt0.S file.
// See AN_398 for examples.
there is a AN398 reference, which I couldn't find on FTDI or BRT sites.

Also, I need to understand how to reduce the imagesize, as i've understood that it takes the whole flash, but I need to know the real allocated space, and change it according to my needs.
Thankyou in advance

4
Discussion - Software / Re: My Gui keeps crashing
« on: April 17, 2019, 08:28:08 AM »
Hi FTDI,
my custom application, of course, was leaking.

All pictures were already on SD card, and with optimization of Eclipse ( -o3 -os ) most of the un-essential part of code were torn off from linker (inspection with map file helped).
The structure itself of ESD is very powerful, instead, in this case I keep it, as it resembles the android app approach.
I had only to tweak some of the generated code to shrink it.
Of course, not all the library code went away, so it has still a big footprint in flash, if only I had more time to work on the prototype I would have worked without ESD.
But now that I've found the problem, I could change 7000+ times (literally) slide without problems, while before the 10th slide change was a dice roll with death....

OT: I'm already registered in Bridgetek community  ;)

5
Discussion - Software / Re: My Gui keeps crashing
« on: April 15, 2019, 01:22:53 PM »
For anybody interested in, I found my leak. ;D ;D ;D ;D

Path: FT_Esd_Widgets\Ft_Esd_FixedPointNumericLabel.c
Method Ft_Esd_FixedPointNumericLabel_End_Signal

The Free(context) is not reached (IMHO), but I've implemented che context-> Number char * as a statically created
Code: [Select]
char Number_string[Size_Buffer];so,
Code: [Select]
context->Number = &(context->Number_string[0]);

makes everything work like before. *but* without any leakage, as the array is destroyed when the widget is destroyed.

I suggest, for anybody using the fixed point numeric label, altering the library.
Also, same structure can be found in Ft_Esd_NumericLabel, so I suggest doing the same there.

This will loose ten precious bytes, but will leave the heap cleaner.

6
Discussion - Software / Re: My Gui keeps crashing
« on: April 15, 2019, 09:16:23 AM »
Update: I've traversed the structure and noticed that the structure built by EVE has a very lazy garbage collector, I've moved a Ft_Esd_Widget_ProcessFree() to the Ft_Esd_widget_Free() [I'm working within ft_esd_wiget.c] and so I' "improved" it.
But that's not enough, instead of locking after 10-15 page moves, now it locks after 50 (not counted)?

Seems to me that the malloc()/free() function has some fragmentation
This is a simple printout of my mallinfo() after each of page switch:

Code: [Select]
Before Init page 1 Heap Blocks = 17252; free = 20360 ; total = 37612
 After Init page 1 Heap Blocks = 23300; free = 14312 ; total = 37612
Before Init page 0 Heap Blocks = 17252; free = 20360 ; total = 37612
 After Init page 0 Heap Blocks = 20628; free = 16984 ; total = 37612
Before Init page 1 Heap Blocks = 17348; free = 20264 ; total = 37612
 After Init page 1 Heap Blocks = 23396; free = 14216 ; total = 37612

mi.uordblks, mi.fordblks, mi.arena

as you can see, the heap [uordblks] keeps growing...

Any suggestion?

7
Discussion - Software / My Gui keeps crashing
« on: April 12, 2019, 10:48:17 AM »
The problem is that every since my GUI stops working, let's start from the beginning

-FT902 + FT812 custom board-

From EVE 4.5 I got widgets and so on, positioned with layouts, built images and all of this mess.
Then I've done many under-the-hood personalizations (added CANBus support, USB DFU function, Power Supply Managemet,  code cleaning). Now the project is almost done 8).

BUT, if I switch back and forth many times, the toy crashes  :-\: the application freezes, and there's no other way than reset (reboot via reset pin).

As It apparently was like a memory corruption, when loading some complex page, i've began reading the mallinfo() structure, and every time I switch away and back to a slide, I find the HEAP grew by 96Byte... Also, my first slide, which for a while had a fixed address, after some jumps moved to another address...

This is a 250kB compressed bin application, full of stuff, variables and icons. Where shall I search for the leak?

Let me say there is no room for attach a debug ... code needed a -o3 -oS optimization to be built under eclipse and sent to board. Everything I have is the UART console... or writing on SD, maybe?

Any help will be appreciated.

8
Discussion - Software / Re: A few questions about functions in ESD 4.5
« on: April 09, 2019, 09:25:19 AM »
Hi, LOstrander, you are doing somewhat similar to my project, I have already passed to my custom board for this, but I'm using the Ft812 - Ft902 bundle like yours.

- You can implement the always running functions in the "update" slot of your screens. Else, if you need to call them once, put them in the start slot.
- Functions that don't interact with GUI are "useless" (let me say  ;) , I got your point) in this case. So can / must be in another place.

- Global variables, i'm sorry, I've done them the old way (editing code), so I can't help you.

9
Discussion - Software / EVE down signal: sensing continuous
« on: March 19, 2019, 04:43:20 PM »
Hi there, have you any idea on how to detect that you have a long click on (for instance) a imagebutton ( and do something different in your code ) ?
It involves the down signal, ok, but how would you modify it?


10
Discussion - Software / I2C misunderstanding
« on: March 19, 2019, 03:51:46 PM »
Hi Everybody, I'm working on my custom board, so it's not a good starting point....
I have a 64K I2C serial eeprom. But I don't really understand what's wrong...

Of course, I tested the example on the demo board (MM900EV1A) and worked. (2K eeprom)

First problem, No read - no write.
The location address is 12bit long, so I got the source and altered, but no success.

Code: [Select]
int8_t i2cm_write_twoByte(const uint8_t addr, const uint16_t loc,
const uint8_t *data, uint16_t number_to_write) {
int8_t ret = 0;

if (isHighSpeed) {
/* In high speed mode, the following sequence has to be done before each data transfer
Write Master code 0x09 to I2CMSA and the HIGH SPEED command to I2CMCR */
I2CM->I2CM_SLV_ADDR = 0x09;
I2CM->I2CM_CNTL_STATUS = I2C_FLAGS_HS | I2C_FLAGS_RUN;

/* Wait until I2CM is no longer busy */
if (i2c_wait_for()) { /* An Error Occurred */
ret = -1;
}
}

if (ret == 0) {
/* Write slave address to SA */
I2CM->I2CM_SLV_ADDR = addr;
/* Write command byte address MSB to BUF */
I2CM->I2CM_DATA = (uint8_t) ((loc & 0xFF00) >> 8);

/* Check that the bus is not occupied by another master
(this step is not needed in single-master system or in high speed mode since
arbitration takes place during transmission of the master code) */
if (isHighSpeed == 0) {
while (I2CM->I2CM_CNTL_STATUS & MASK_I2CM_STATUS_BUS_BUSY) {
}
}

/* Write command to I2CMCR to send Start and command byte. */
I2CM->I2CM_CNTL_STATUS = I2C_FLAGS_START | I2C_FLAGS_RUN;
if (i2c_wait_for()) { /* An Error Occurred */
ret = -1;
}
}
if (ret == 0) {
/* Write command byte address LSB to BUF */

I2CM->I2CM_DATA = (uint8_t) (loc & 0xFF);
I2CM->I2CM_CNTL_STATUS = I2C_FLAGS_RUN;
if (i2c_wait_for()) { /* An Error Occurred */
ret = -1;
}
}

if (ret == 0) {
if (number_to_write) {
while (number_to_write-- && ret == 0) {
/* Write command to I2CMCR to send data byte. */
I2CM->I2CM_DATA = *data++;
I2CM->I2CM_CNTL_STATUS = I2C_FLAGS_RUN;
if (i2c_wait_for()) { /* An Error Occurred */
ret = -1;
}
}
}
}

/* Write command to I2CMCR to send Stop. */
I2CM->I2CM_CNTL_STATUS = I2C_FLAGS_STOP;
if (ret == 0) {
i2c_wait_for();
}

return ret;
}

Code: [Select]
int8_t i2cm_read_twoByte(const uint8_t addr, const uint16_t loc, uint8_t *data,
uint16_t number_to_read) {
int8_t ret = 0;

if (isHighSpeed) {
/* In high speed mode, the following sequence has to be done before each data transfer
Write Master code 0x09 to I2CMSA and the HIGH SPEED command to I2CMCR */
I2CM->I2CM_SLV_ADDR = 0x09;
I2CM->I2CM_CNTL_STATUS = I2C_FLAGS_HS | I2C_FLAGS_RUN;

/* Wait until I2CM is no longer busy */
if (i2c_wait_for()) {
ret = -1;
}
}

if (ret == 0) {
/* Write slave address to SA */
I2CM->I2CM_SLV_ADDR = addr;
/* Write command byte address to BUF */
I2CM->I2CM_DATA = (uint8_t) ((loc & 0x1f00) >> 8);

/* Check that the bus is not occupied by another master
(this step is not needed in single-master system or in high speed mode since
arbitration takes place during transmission of the master code) */
if (isHighSpeed == 0) {
while (I2CM->I2CM_CNTL_STATUS & MASK_I2CM_STATUS_BUS_BUSY) {
}
}

/* Write command to I2CMCR to send Start and command byte. */
I2CM->I2CM_CNTL_STATUS =
I2C_FLAGS_START | I2C_FLAGS_RUN | I2C_FLAGS_ACK;

if (i2c_wait_for()) {
ret = -1;
}
}
if (ret == 0) {
I2CM->I2CM_DATA = (uint8_t) (loc & 0x00ff);
I2CM->I2CM_CNTL_STATUS = I2C_FLAGS_RUN | I2C_FLAGS_ACK;
if (i2c_wait_for()) {
ret = -1;
}
}
if (ret == 0) {
/* Write slave address to SA with R operation */
I2CM->I2CM_SLV_ADDR = addr | 0x01;

if (number_to_read <= 1)
/* Receive with a NACK */
I2CM->I2CM_CNTL_STATUS = I2C_FLAGS_START | I2C_FLAGS_RUN;
else
/* Receive with an ACK */
I2CM->I2CM_CNTL_STATUS = I2C_FLAGS_START | I2C_FLAGS_RUN
| I2C_FLAGS_ACK;

if (i2c_wait_for()) {
ret = -1;
}
}

if (ret == 0) {
while (number_to_read) {
*data++ = I2CM->I2CM_DATA;
number_to_read--;

if (number_to_read) {
if (number_to_read == 1)
/* Last one, Receive with a NACK */
I2CM->I2CM_CNTL_STATUS = I2C_FLAGS_RUN;
else
/* Receive with an ACK */
I2CM->I2CM_CNTL_STATUS = I2C_FLAGS_RUN | I2C_FLAGS_ACK;

/* Write command to I2CMCR to read data byte.
I2CM->I2CM_CNTL_STATUS = I2C_FLAGS_RUN; */
if (i2c_wait_for()) {
ret = -1;
break;
}
}
}
}

/* Write command to I2CMCR to send Stop. */
I2CM->I2CM_CNTL_STATUS = I2C_FLAGS_STOP;
if (ret == 0) {
i2c_wait_for();
}

return ret;
}

Memory is Microchip 24LC64, 5 pin SOT23 (no hardware address).

Any idea where to look for the problem?

11
Thank you, Kaetemi, I'll give a try to your solution, when I can move again with ESD project.

Can You explain a little the structure?

ESD_Project (top folder)
|-- Project( where exporting ) (subfolder level 1)
|-- EclipseProjectSrc (subfolder level 1)

Is your idea?

12
Discussion - Software / Re: Eve Screen Designer or EVE Screen Editor
« on: February 18, 2019, 10:59:35 AM »
Be aware, caveat ahead!

The screen design will need some interaction with other code / hardware, so both approach will lead to some tweaks.

I found my way using EVE Screen Designer, then editing via Eclipse some of the generated code (which can be done in a easy manner) to obtain desidered behaviour.

13
ThankYou, pauljiao ,
your way is a kind of hack method. 
I understand it, but as far as my final sistem will have something like 150+ values, maybe working on the code side (Eclipse) will be the better approach, building the interface before and hacking after.

Nontheless, I'll give this strategy a try  ;)

14
I DID IT  ;D ;D ;D ;D Hope You were stille following, but also for future readers.
So, that's easy, when you get it how it works!

Think in a "DataModel" way, that is "I store something somewhere, for who needs it"

Say you put something (the value) in a variable somewhere. Your variable will be updated somewhere in your code.
In my example, an event on UART0 toggles a boolean.

Then, here's the trick: find the label you want to change (will be named like you read in ESD), so you can search a  <PAGENAME>_<ESD_LABEL_NAME>_Text__Property

Pagename = FirstPage;
ESD_LABEL_NAME=CELL_VAL_1;

Now locate in <PAGENAME>__Generated.c file the

Code: [Select]
static const char * FirstPage_CELL_VAL_1_Text__Property(void *context);You will find it slightly different. Because you will find

Code: [Select]
static const char * FirstPage_CELL_VAL_1_Text__Property(void *context){return "ESD";}if "ESD" was the text you put via EveScreenDesigner.

Now implement it another way, like
Code: [Select]
int i=0;
static const char * FirstPage_CELL_VAL_1_Text__Property(void *context) {
   char * str;
   if (upcounting) {
      sprintf(str, "%d", ++i);
   } else {
      sprintf(str, "%d", --i);

   }

   return str;
}

And "magically" you're done! Because the EVE engine works for you, automatically refreshing the value read from somewere else.
Obviously you have to let it do so, leaving to it the update and render slots on your widgets.

15
Hi Jimmy
Hi Christian

If you did solve your problem (which is essentially the same as mine) it would be great to get some pointers...

Cheers

Jimmy
I'm stuck on it too... did you get some updates?
I'm building a console & canbus driven display, and I'm trying my best to understand the way to pass data to screen.

Pages: [1] 2