Code Monkey home page Code Monkey logo

libfx2's Introduction

libfx2's People

Contributors

carlossless avatar cr1901 avatar gregdavill avatar ho-ro avatar jjakob avatar vifino avatar whitequark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libfx2's Issues

build issue with latest sdcc svn version

Somehow the build failed with latest svn version of sdcc.
Tested under Ubuntu 20.04.

mcuee@UbuntuSwift3:~/build/cyusb/libfx2$ make -C firmware
...
...
sdcc -mmcs51 --std-sdcc99 -Iinclude  --model-huge -c -o build/huge/usbdfu.rel usbdfu.c
include/fx2ints.h:43: warning 283: function declarator with no prototype
include/fx2ints.h:44: warning 283: function declarator with no prototype
include/fx2ints.h:45: warning 283: function declarator with no prototype
include/fx2ints.h:46: warning 283: function declarator with no prototype
include/fx2ints.h:47: warning 283: function declarator with no prototype
include/fx2ints.h:48: warning 283: function declarator with no prototype
include/fx2ints.h:49: warning 283: function declarator with no prototype
include/fx2ints.h:50: warning 283: function declarator with no prototype
include/fx2ints.h:51: warning 283: function declarator with no prototype
include/fx2ints.h:52: warning 283: function declarator with no prototype
include/fx2ints.h:53: warning 283: function declarator with no prototype
include/fx2ints.h:54: warning 283: function declarator with no prototype
include/fx2ints.h:55: warning 283: function declarator with no prototype
include/fx2ints.h:77: warning 283: function declarator with no prototype
include/fx2ints.h:78: warning 283: function declarator with no prototype
include/fx2ints.h:79: warning 283: function declarator with no prototype
include/fx2ints.h:80: warning 283: function declarator with no prototype
include/fx2ints.h:81: warning 283: function declarator with no prototype
include/fx2ints.h:82: warning 283: function declarator with no prototype
include/fx2ints.h:83: warning 283: function declarator with no prototype
include/fx2ints.h:84: warning 283: function declarator with no prototype
include/fx2ints.h:85: warning 283: function declarator with no prototype
include/fx2ints.h:86: warning 283: function declarator with no prototype
include/fx2ints.h:87: warning 283: function declarator with no prototype
include/fx2ints.h:88: warning 283: function declarator with no prototype
include/fx2ints.h:89: warning 283: function declarator with no prototype
include/fx2ints.h:90: warning 283: function declarator with no prototype
include/fx2ints.h:91: warning 283: function declarator with no prototype
include/fx2ints.h:92: warning 283: function declarator with no prototype
include/fx2ints.h:93: warning 283: function declarator with no prototype
include/fx2ints.h:94: warning 283: function declarator with no prototype
include/fx2ints.h:95: warning 283: function declarator with no prototype
include/fx2ints.h:96: warning 283: function declarator with no prototype
include/fx2ints.h:97: warning 283: function declarator with no prototype
include/fx2ints.h:98: warning 283: function declarator with no prototype
include/fx2ints.h:99: warning 283: function declarator with no prototype
include/fx2ints.h:100: warning 283: function declarator with no prototype
include/fx2ints.h:101: warning 283: function declarator with no prototype
include/fx2ints.h:102: warning 283: function declarator with no prototype
include/fx2ints.h:103: warning 283: function declarator with no prototype
include/fx2ints.h:126: warning 283: function declarator with no prototype
include/fx2ints.h:127: warning 283: function declarator with no prototype
include/fx2ints.h:128: warning 283: function declarator with no prototype
include/fx2ints.h:129: warning 283: function declarator with no prototype
include/fx2ints.h:130: warning 283: function declarator with no prototype
include/fx2ints.h:131: warning 283: function declarator with no prototype
include/fx2ints.h:132: warning 283: function declarator with no prototype
include/fx2ints.h:133: warning 283: function declarator with no prototype
include/fx2ints.h:134: warning 283: function declarator with no prototype
include/fx2ints.h:135: warning 283: function declarator with no prototype
include/fx2ints.h:136: warning 283: function declarator with no prototype
include/fx2ints.h:137: warning 283: function declarator with no prototype
include/fx2ints.h:138: warning 283: function declarator with no prototype
include/fx2ints.h:139: warning 283: function declarator with no prototype
include/fx2usb.h:186: warning 283: function declarator with no prototype
include/fx2usbdfu.h:60: warning 283: function declarator with no prototype
sdar rc lib/huge/fx2dfu.lib build/huge/usbdfu.rel
sdcc -mmcs51 --std-sdcc99 -Iinclude  --model-huge -c -o build/huge/uf2scsi.rel uf2scsi.c
sdcc -mmcs51 --std-sdcc99 -Iinclude  --model-huge -c -o build/huge/uf2fat.rel uf2fat.c
sdar rc lib/huge/fx2uf2.lib build/huge/uf2scsi.rel build/huge/uf2fat.rel
make[1]: Leaving directory '/home/mcuee/build/cyusb/libfx2/firmware/library'
make[1]: Entering directory '/home/mcuee/build/cyusb/libfx2/firmware/boot-cypress'
sdcc -mmcs51 --iram-size 0x100 --code-size 0x3e00 --xram-loc  0x3e00 --xram-size 0x0200 --std-sdcc99 --model-small  -I../library/include -L../library/lib/small -Wp,-MQ,build/main.rel,-MMD,build/main.d -c -o build/main.rel main.c
sdcpp: warning: '-x c' after last input file has no effect
cc1: fatal error: build/main.d: No such file or directory
compilation terminated.
at 1: warning 190: ISO C forbids an empty translation unit
subprocess error 256
make[1]: *** [../library/fx2rules.mk:39: build/main.rel] Error 1
make[1]: Leaving directory '/home/mcuee/build/cyusb/libfx2/firmware/boot-cypress'
make: *** [Makefile:4: all] Error 2
make: Leaving directory '/home/mcuee/build/cyusb/libfx2/firmware'

mcuee@UbuntuSwift3:~/build/cyusb/libfx2$ sdcc -v
SDCC : mcs51/z80/z180/r2k/r2ka/r3ka/sm83/tlcs90/ez80_z80/z80n/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15/mos6502 TD- 4.2.14 #14088 (Linux)
published under GNU General Public License (GPL)

i2c bus scan

Hello,
First, thanks for making this API available. It helped a lot.
I have an old DVB-T dongle derived from the FX2LP connected to an i2c device.
To know what address it is using, I'm using the following code:

#include <fx2i2c.h>
//#include <fx2regs.h>
#include <fx2lib.h>
//#include <stdio.h>

// Scratchpad is from 0xe000 to 0xe1fff (cf TRM sec 5.3 / EZ USB FX2LP p11)

int main() {

  uint8_t i;
 bool r;
 for (i=0;i<128;i++) {
     r=i2c_start(i);
     if (r)
       scratch[i]=i;
     else
       scratch[i]=0x00;
     i2c_stop();
   }
 while (1);
}

The problem is that the dump shows 00 for every element.
Any hint ?

--
Fabien

cdc-acm example: port disabled by hub

I tried to start the cdc-acm example on Numato Opsis board. It results in the device being enumerated correctly but when I try to read or write to to serial at /dev/ttyACM0 the kernel disables the device:

[264968.588502] usb usb1-port6: disabled by hub (EMI?), re-enabling...

It then gets enumerated correctly again, e.g.

[264098.323234] usb 1-6: USB disconnect, device number 36
[264098.580121] usb 1-6: new high-speed USB device number 37 using xhci_hcd
[264098.721757] usb 1-6: New USB device found, idVendor=04b4, idProduct=8613, bcdDevice= 0.00
[264098.721764] usb 1-6: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[264098.721767] usb 1-6: Product: FX2 series serial interface example
[264098.721771] usb 1-6: Manufacturer: [email protected]
[264098.725829] cdc_acm 1-6:1.0: ttyACM0: USB ACM device
[264968.588502] usb usb1-port6: disabled by hub (EMI?), re-enabling...
[264968.588504] usb 1-6: USB disconnect, device number 37
[264968.845672] usb 1-6: new high-speed USB device number 38 using xhci_hcd
[264968.987283] usb 1-6: New USB device found, idVendor=04b4, idProduct=8613, bcdDevice= 0.00
[264968.987287] usb 1-6: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[264968.987289] usb 1-6: Product: FX2 series serial interface example
[264968.987291] usb 1-6: Manufacturer: [email protected]
[264968.989257] cdc_acm 1-6:1.0: ttyACM0: USB ACM device
[265520.727085] usb usb1-port6: disabled by hub (EMI?), re-enabling...

I wonder if you have any idea why this would happen. It seems like the device is sending
something when it shouldn't? However I haven't been able to find out which transfer is causing the problem.

How to write a response in chunks (USB control read)?

I am trying to write large responses to a USB control read. The data is read in chunks of 32 bytes from a i2c device and feeds EP0BUF.

I had a look at something similar in the Glasgow firmware and wrote this:

uint8_t USB_REQ_ATECC_READ = 0x20;

if((req->bmRequestType == (USB_RECIP_DEVICE|USB_TYPE_VENDOR|USB_DIR_IN)) &&
   req->bRequest == USB_REQ_ATECC_READ) {
  uint8_t arg_slot = req->wValue;
  uint8_t arg_offset = req->wIndex;
  uint16_t arg_len = req->wLength;
  pending_setup = false;

  while(arg_len > 0) {
    uint8_t chunk_len = arg_len < 32 ? arg_len : 32;

    while(EP0CS & _BUSY);
    memset(EP0BUF, 0xFF, chunk_len); // whatever
    SETUP_EP0_BUF(chunk_len);

    arg_len  -= chunk_len;
    arg_offset += 1;
  }

  return;
}

I removed the i2c-related code so I just expect the FX2 to send garbage data. However, when I request more than 32 bytes (e.g. 33), I always receive 32 bytes:

data = await device.control_read(usb1.REQUEST_TYPE_VENDOR, REQ_ATECC_READ, 0, 0, 33)
print(len(data)) # == 32

In other cases, an usb1.USBErrorPipe: LIBUSB_ERROR_PIPE [-9] exception is thrown.

Sorry for opening an issue here as this is probably not an issue with the libfx2 implementation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.