Willem Jansen | 25 May 2013 08:15
Picon

Beginner question regarding I/O ports

Hello fellow developers,

I have a simple beginner question regarding the I/O ports. I got a simple Development Board of the 56pin version of the cy7c68013a.
(http://www.ebay.de/itm/EZ-USB-FX2LP-CY7C68013A-USB-Development-Core-Board-Module-Logic-Analyzer-EEPROM-/400470811401?pt=LH_DefaultDomain_77&hash=item5d3deba309)

To get started I want to see the I/O Pins of the chip to change from 3.3V to 0V and back. I therefore changed to lights-example as follows:

#include <fx2regs.h> #include <lights.h> #include <delay.h>
void main(void) {     // loop endlessly     for(;;) {        delay(3000);        IOD=0x00;        delay(3000);        IOD=0xFF;     } }

However, my voltmeter does not show any changes once I loaded it with
"sudo fx2load -v 0x04b4 -p 0x0082 build/lights.bix"

To be even more precise, I seems that all pins of the IOD-port are somewhat disconnected, as there is no voltage difference neither to and GND nor the 3.3V Pins.

Any ideas?

  Regards,
    Willem
-- ----------------------------- Willem Jansen
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Fx2lib-devel mailing list
Fx2lib-devel@...
https://lists.sourceforge.net/lists/listinfo/fx2lib-devel
SourceForge.net | 25 Jan 2013 11:17
Picon

[ fx2lib-Issues-2909385 ] segmentation fault

Issues item #2909385, was opened at 2009-12-05 11:45
Message generated for change (Comment added) made by maartenbrock
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1126193&aid=2909385&group_id=247216

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: segmentation fault

Initial Comment:
Receive segmentation fault from sdcclib due to a bad memory access when making fx2.lib.

Using sdcclib v1.2 and sdcc v2.9.0 on Mac OS X i386 (Snow Leopard v10.6.2).

Do not receive this error when using sdcclib for building other libraries, also for the FX2.

----------------------------------------------------------------------

Comment By: Maarten Brock (maartenbrock)
Date: 2013-01-25 02:17

Message:
Since the patch was applied and also a new release of SDCC (actually
several by now) has been made, can't this be closed?

----------------------------------------------------------------------

Comment By: Chris Hiszpanski (chiszp)
Date: 2009-12-05 12:37

Message:
Correction on my last post, should be:

sdcc fx2.lib build/serial.rel build/i2c.rel ...

----------------------------------------------------------------------

Comment By: Chris Hiszpanski (chiszp)
Date: 2009-12-05 12:34

Message:
This is a problem with sdcclib, not fx2lib. In particular, line 61 in
version 1.2 of sdcclib is:

for(; (path[i]!='\\')&&(path[i]!='/')&&(i>=0); i--);

When i = -1, path[-1] will be accessed before the i>=0 check exits the
loop. A work around is to generate a temporary build directory for your
.rel files and call sdcclib as:

sdcclib fx2.lib build/serial.rel i2c.rel ...

The loop will terminate when it reaches the '/', before i == -1.

However, to fix the bug in sdcclib, change the line to:

for(; (i>=0)&&(path[i]!='\\')&&(path[i]!='/'); i--);

This is patch #2788108 in the sdcc project:

http://sourceforge.net/tracker/?func=detail&aid=2788108&group_id=599&atid=300599

We should see it in the next version.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1126193&aid=2909385&group_id=247216

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
Tim michals | 17 Jan 2013 02:06
Picon
Favicon

(no subject)

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Fx2lib-devel mailing list
Fx2lib-devel@...
https://lists.sourceforge.net/lists/listinfo/fx2lib-devel
Marco Casadio | 30 Apr 2012 13:10
Picon

FX2 firmware

I've tried to build fx2-lib basic firmware from fw directory and the hex file has been generated correctly. But, if i run this firmware on my FX2LP, the device is not able to enumerate in the rigth way. In particular, Windows says "USB Unknown device". 

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fx2lib-devel mailing list
Fx2lib-devel@...
https://lists.sourceforge.net/lists/listinfo/fx2lib-devel
Maarten Brock | 23 Apr 2012 22:37
Picon

Re: View program size

Hello Andronic,

> Could you explain me why XRAM end CODE pages have the same start address
> (0x0000) without creating conflict?

No, I cannot, because on an FX2 they DO create a conflict. But SDCC was
not written for the FX2, but for the Intel 8051 instead. And the original
8051 has separate XRAM and separate CODE memory. So YOU must split the
memory using the --code-loc and --xdata-loc command line switches. And
while you're at it also supply SDCC with --code-size and --xdata-size so
it will warn of memory overflows.

Apart from reading the FX2 datsheets and the SDCC manual I advise you to
also read the original 8051 datasheet, a.k.a. the 8051 bible, to get
familiar with the architecture. Google it you will find it.

And please do not reply to me personally, but to the whole list so
everyone can benefit. If you want my personal guidance I expect you to pay
my salary.

Maarten

> Other memory:
>>    Name             Start    End      Size     Max
>>    ---------------- -------- -------- -------- --------
>>    PAGED EXT. RAM                         0      256
>>    EXTERNAL RAM     0x0000   0x0030      49    65536
>>    ROM/EPROM/FLASH  0x0000   0x3fb7    5711    65536
>>
>
>
>
> On Sun, Apr 15, 2012 at 11:40 AM, ANDRONIC BOANARIJESY
> <androjes@...>wrote:
>
>> Thank you very much Maarten :)
>>
>>
>> On Sun, Apr 15, 2012 at 10:29 AM, Maarten Brock
>> <sourceforge.brock@...>wrote:
>>
>>> Hi,
>>>
>>> > I can't see where are the code, xram sizes in my .mem file.
>>> > Could you show me?
>>>
>>> Yes:
>>>
>>> > ################################################
>>> > firmware.mem
>>> > ################################################
>>> > Internal RAM layout:
>>> >       0 1 2 3 4 5 6 7 8 9 A B C D E F
>>> > 0x00:|0|0|0|0|0|0|0|0|a|a|a|a|a|a|a|Q|
>>> > 0x10:|Q|Q| | | | | | | | | | | | | | |
>>> > 0x20:|B|T|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
>>> > 0x30:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
>>> > 0x40:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
>>> > 0x50:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
>>> > 0x60:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
>>> > 0x70:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
>>> > 0x80:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
>>> > 0x90:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
>>> > 0xa0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
>>> > 0xb0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
>>> > 0xc0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
>>> > 0xd0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
>>> > 0xe0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
>>> > 0xf0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
>>> > 0-3:Reg Banks, T:Bit regs, a-z:Data, B:Bits, Q:Overlay, I:iData,
>>> S:Stack,
>>> > A:Absolute
>>> >
>>> > Stack starts at: 0x22 (sp set to 0x21) with 222 bytes available.
>>> >
>>> > Other memory:
>>> >    Name             Start    End      Size     Max
>>> >    ---------------- -------- -------- -------- --------
>>> >    PAGED EXT. RAM                         0      256
>>>
>>> Here is the XRAM (aka external ram):
>>>
>>> >    EXTERNAL RAM                           0      512
>>>
>>> And here is the code:
>>>
>>> >    ROM/EPROM/FLASH  0x0000   0x3fb7    2637    15360
>>>
>>> > #############################################################
>>> >
>>> > The last line ( EXTERNAL RAM)  means that I don't use a Xram?
>>>
>>> Indeed, no paged or non-paged xram was used.
>>>
>>> >
>>> >
>>> > On Sun, Apr 15, 2012 at 9:06 AM, Maarten Brock <
>>> sourceforge.brock@...>wrote:
>>> >
>>> > > Hi,
>>> > >
>>> > > Just open the .mem file.
>>> > >
>>> > > Maarten
>>> > >
>>> > > > Hi everyone,
>>> > > >
>>> > > > How can I see the program size (xram, code, data) on SDCC after
>>> > > compiling?
>>> > > >
>>> > > > with Keil, we could see:
>>> > > > Program Size: data=90.0 xdata=4492 code=5455
>>> > > >
>>> > > > Build target 'RAM'
>>> > > > assembling dscr.a51...
>>> > > > compiling fw.c...
>>> > > > Source\fw.c(34): warning C317: attempt to redefine macro '_IFREQ'
>>> > > > compiling device.c...
>>> > > > linking...
>>> > > > Program Size: data=90.0 xdata=4492 code=5455
>>> > > > [...]
>>> > > >
>>> > > >
>>> > > > --
>>> > > > Mr. Andronic BOANARIJESY
>>> > > >      Software Engineer
>>> > > >
>>> > >
>>> > >
>>> > >
>>> > >
>>> > >
>>> ------------------------------------------------------------------------------
>>> > > For Developers, A Lot Can Happen In A Second.
>>> > > Boundary is the first to Know...and Tell You.
>>> > > Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
>>> > > http://p.sf.net/sfu/Boundary-d2dvs2
>>> > > _______________________________________________
>>> > > Fx2lib-devel mailing list
>>> > > Fx2lib-devel@...
>>> > > https://lists.sourceforge.net/lists/listinfo/fx2lib-devel
>>> > >
>>> >
>>> >
>>> >
>>> > --
>>> > Mr. Andronic BOANARIJESY
>>> >      Software Engineer
>>> >      Tel :  +212 6 38 88 28 37
>>> >      Morocco
>>> >
>>>
>>>
>>>
>>
>>
>> --
>> Mr. Andronic BOANARIJESY
>>      Software Engineer
>>      Tel :  +212 6 38 88 28 37
>>      Morocco
>>
>>
>
>
> --
> Mr. Andronic BOANARIJESY
>      Software Engineer
>      Tel :  +212 6 38 88 28 37
>      Morocco
>

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
ANDRONIC BOANARIJESY | 15 Apr 2012 09:23
Picon

View program size

Hi everyone,

How can I see the program size (xram, code, data) on SDCC after compiling?

with Keil, we could see:
Program Size: data=90.0 xdata=4492 code=5455

Build target 'RAM'
assembling dscr.a51...
compiling fw.c...
Source\fw.c(34): warning C317: attempt to redefine macro '_IFREQ'
compiling device.c...
linking...
Program Size: data=90.0 xdata=4492 code=5455
[...]


--
Mr. Andronic BOANARIJESY
     Software Engineer

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Fx2lib-devel mailing list
Fx2lib-devel@...
https://lists.sourceforge.net/lists/listinfo/fx2lib-devel
Vincent Pelletier | 22 Jan 2012 12:10
Picon

Re: Isochronous Streaming Using LibUSB from FPGA

Hi.

<offtopic>
Sorry, this message is not properly threaded: I just happened to find the 
original thread in archives, and I cannot find a way to get relevant mail 
headers.
I hope this mail will catch original poster's attention.
</offtopic>

Nice to see someone using my python-libusb1 for isochronous with (some) 
success ! I must admit I haven't tested isochronous transfers support properly 
myself.

I have some comments on the python script from original post which might help 
improving the situation, if that's still relevant:
- You are creating one transfer object per actual transfer. You should
  probably reuse them instead by calling "newxfer.submit()" in
  SubmitThread.createDataThread. In turn, you should remove the infinite loop
  in SubmitThread.run, so that you only create a fixed amount of transfers,
  submit them, and do nothing (actually just looping over handleEvents()).
  In turn, this means you don't need to have 2 threads for creating transfers
  and handling events: just do that sequentially.
- You are creating one throw-away thread per completed transfer. I'm afraid
  this has quite some overhead, with little benefit because of the python GIL.
  I would instead immediately handle data in transfer callback (if processing
  is fast enough and you have enough submited transfers to always have some
  still submited) or otherwise pipe them to another thread/process.

Resulting code would look like:

import usb1

def handleData(transfer):
    # Fetch data from transfer here, check status to see if you should really
    # re-submit (you probably don't want to if status shows an error).
    transfer.submit()
    # Do some data handling/piping here.
    print "We phoned home."

def main():
    context=usb1.LibUSBContext()
    context.setDebug(3)
    fx2=self.context.openByVendorIDAndProductID(0x04b4,0x1004)
    fx2.claimInterface(0)
    for _ in xrange(10): # Tweak this magic "10"
        transfer_object1=fx2.getTransfer(500)
        transfer_object1.setIsochronous(endpoint=0x82,buffer_or_len=(1024*500),
          callback=handleData)
        transfer_object1.submit()
    while True:
        context.handleEvents()

if __name__ == '__main__':
    main()

Regards,
--

-- 
Vincent Pelletier

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
Daniel O'Connor | 16 Sep 2011 10:27
Picon
Favicon

Setupdata at 0xe000

Hi,
I recently found myself running out of space on my FX2 firmware so I did a bit of remapping things to squeeze
out some more room.

One thing I did was to put the descriptors at 0xe000 and this worked, however I found that string descriptors
didn't work.

After bashing my head against the desk for a bit I realised it was because they are declared as __code rather
than __xdata. The device descriptor still works because (I think) it uses SUDPTRH/L.

I have the following diff..
Index: lib/setupdat.c
===================================================================
RCS file: /usr/local/Genesis/cvs/micro/lib/fx2lib/lib/setupdat.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 setupdat.c
--- lib/setupdat.c	26 Feb 2011 06:40:02 -0000	1.1.1.1
+++ lib/setupdat.c	16 Sep 2011 08:15:34 -0000
 <at>  <at>  -271,11 +271,14  <at>  <at>  BOOL handle_set_feature() {
 /* these are devined in dscr.asm
    and need to be customized then
    linked in by the firmware manually */
-extern __code WORD dev_dscr;
-extern __code WORD dev_qual_dscr;
-extern __code WORD highspd_dscr;
-extern __code WORD fullspd_dscr;
-extern __code WORD dev_strings;
+#ifndef DSCR_ADDRSPACE
+#define DSCR_ADDRSPACE __code
+#endif
+extern DSCR_ADDRSPACE WORD dev_dscr;
+extern DSCR_ADDRSPACE WORD dev_qual_dscr;
+extern DSCR_ADDRSPACE WORD highspd_dscr;
+extern DSCR_ADDRSPACE WORD fullspd_dscr;
+extern DSCR_ADDRSPACE WORD dev_strings;

 WORD pDevConfig = (WORD)&fullspd_dscr;
 WORD pOtherConfig = (WORD)&highspd_dscr;

To go with this I have a local only diff to modify SDCCFLAGS in lib/Makefile to set it.

My earlier changes where to build code with..
CFLAGS=        -mmcs51 --code-size 0x3e00 --xram-size 0x0100 --xram-loc 0x3e00 --stack-auto
LDFLAGS=       -Wl"-b DSCR_AREA=0xe000" -Wl"-b INT2JT=0x3f00" 

ie I cut RAM in half after checking the SDCC report.

Also it seems that the 'default' (i.e. what's in the examples) --xram-loc is conservative.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
Xiaofan Chen | 7 Aug 2011 12:49
Picon

Invitation to connect on LinkedIn

LinkedIn

fx2lib,

I'd like to add you to my professional network on LinkedIn.

- Xiaofan

Xiaofan Chen
Staff Engineer at Rockwell Automation
Singapore

Confirm that you know Xiaofan

© 2011, LinkedIn Corporation

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Fx2lib-devel mailing list
Fx2lib-devel@...
https://lists.sourceforge.net/lists/listinfo/fx2lib-devel
Phil Behnke | 7 Jul 2011 18:33
Picon

Isochronous Streaming Using LibUSB from FPGA

Hi All,

I've been have a issue streaming data from an FPGA to a PC using the FX2LP and LibUSB.  The FPGA is sending 8 bits to the FX2 at a rate of 20MHz (152 Mbps) using isochronous mode.  The problem I'm having is that I cannot get data from the FX2's buffer to the PC fast enough and the buffer becomes full, causing me to miss some data.  I'm not sure where the bottle neck is.  The FX2 is set to iso mode, with 1024 bytes per packet, and 3 packets per microframe, so I should have enough bandwidth to empty the buffer.  I'm attached my firmware (fpga.c), descriptor file, and libusb driver.  The driver was written in Python using python-libusb1 wrappers.  I have a LED on the FPGA board which will read the FULL flag on the FX2 and light an LED when full.  By inspection, it looks like the LED is lit at about 50% duty cycle.  I've been working on this for quite a while and would really appreciate any tips.

Thanks!

Best Regards,
Phil Behnke

Attachment (test.py): text/x-python, 2781 bytes
Attachment (dscr.a51): application/octet-stream, 6918 bytes
Attachment (fpga.c): text/x-csrc, 4919 bytes
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Fx2lib-devel mailing list
Fx2lib-devel@...
https://lists.sourceforge.net/lists/listinfo/fx2lib-devel
S S | 15 Jun 2011 14:45
Picon
Favicon

i2c write to eeprom

Hi Folks,

Could I suggest we modify the i2c eeprom_write function in i2c.c to the code given below?

The current function writes one byte at a time on the eeprom. This is less than optimum as each write triggers a refresh on the eeprom which refreshes a whole page (64 bytes).
That is sub-optimal on two accounts: 1- the eeprom endurance is specified in number of page refresh (OK at 1 million it might not be an issue) but 2- it takes about 64 times longer than needed to write a program into the eeprom.
Modifying the function to write 64 bytes at a time (which fit nicely in one EP0 transfer) cuts down the program writing time from 73s down to 2s.

Cheers,

Sébastien

BOOL eeprom_write(BYTE prom_addr, WORD addr, WORD length, BYTE* buf)
{
  BYTE addr_len=0;
  BYTE addr_buffer[2];
  BYTE bs;
  BYTE *data_buffer_ptr = buf;
  BYTE *last_data_ptr = buf + length;

  if (EEPROM_TWO_BYTE) {
    addr_len = 2;
    addr_buffer[0] = MSB(addr);
    addr_buffer[1] = LSB(addr);
  }
  else {
    addr_len = 1;
    addr_buffer[0] = LSB(addr);
  }

  while ( data_buffer_ptr < last_data_ptr ) {
    if ( (last_data_ptr - data_buffer_ptr) > MAX_EEP_WRITE) { // Should not be the case if data is from an EP0 transfer
      bs = MAX_EEP_WRITE;
    }
    else bs = last_data_ptr - data_buffer_ptr;
    if ( ! i2c_write ( prom_addr, addr_len, addr_buffer, bs, data_buffer_ptr ) ) return FALSE;
    addr += bs; // Potentially more data to come so remember to increase the address and buffer pointer
    data_buffer_ptr += bs;
  }
  return TRUE;
}


------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Fx2lib-devel mailing list
Fx2lib-devel@...
https://lists.sourceforge.net/lists/listinfo/fx2lib-devel

Gmane