Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default firmware #1

Open
asyarifstudio opened this issue Feb 20, 2023 · 6 comments
Open

default firmware #1

asyarifstudio opened this issue Feb 20, 2023 · 6 comments

Comments

@asyarifstudio
Copy link

What is the default firmware out of the box? does this default firmware support USB Host mode? or do we need to flash a example host firmware available in this repository?

@machdyne
Copy link
Owner

Hi. The default firmware is usually test_gpio. I've just now added UF2 images for the other firmware examples.

If you hold the BOOTSEL button during power-up, it should show up as a mass storage device on the computer connected to USB via a male-male cable, and you can then drag-and-drop one of the UF2s to the device. This can also be done over the SWD interface.

Please let me know if you have any further questions.

@asyarifstudio
Copy link
Author

hi

Thanks for answering the question. I have some follow question and confirmation

  1. in host_musli_kbd.uf2, does it use SPI to send data to the PMOD? if yes, I guess the PMOD SPI mapping follow the guideline in this repo, right?
  2. in host_musli.uf2, does it use UART to send data to the PMOD?, I guess the similar pin mapping also follow the guideline

just to share, I want to connect the MUSLI to Genesys 2 FPGA Board so I can communicate to Cinterion Modem Board over the USB. just in case if you some thought how to use the MUSLI properly for such usecase.

@machdyne
Copy link
Owner

  1. Yes, the SPI data is sent on the pins defined in the README:

https://github.com/machdyne/musli#12-pin-pmod-header

  1. I believe the host_musli example is identical to the cdc_msc_hid example from TinyUSB. It should print debug messages to the UART pins as defined in the README.

If the modem uses USB CDC then the task may be relatively simple:

I have just now added a host_musli_cdc source and firmware image, this is the TinyUSB example with only CDC enabled.

After programming that firmware, you will need to unplug the male-male USB cable and switch Musli to USB host mode (J1 open, J2 short). Then plug Musli into the FPGA board, which will provide power.

PMOD pin 1 is TX and pin 2 is RX.

You can then plug in a USB CDC device and Musli should act as a USB CDC <-> PMOD UART bridge.

Make sure to unplug the PMOD and switch back to stand-alone device mode if you need to program the firmware again over USB (this is less cumbersome when using SWD to program).

@asyarifstudio
Copy link
Author

Hi

Thanks a lot for your prompt answer. I'm using Thales B80 and I'm not sure whether it's CDC enabled or not but certainly the device class is 0. Here is the full description of the modem.

  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x0403 Future Technology Devices International, Ltd
  idProduct          0x6001 FT232 USB-Serial (UART) IC
  bcdDevice            6.00
  iManufacturer           1 
  iProduct                2 
  iSerial                 3 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower               90mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              2 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0

I will try to use the cdc host firmware nevertheless and see how it goes.

@asyarifstudio
Copy link
Author

asyarifstudio commented Feb 21, 2023

Hi

One more thing

You can then plug in a USB CDC device and Musli should act as a USB CDC <-> PMOD UART bridge.

what would be the baudrate of the UART bridge? I need to set the UARTLite IP with correct baudrate, and I could not get any info from the code. does it use default 9600 baudrate? or is it set somewhere else?

I also cannot find the host_musli_cdc image in your latest commit

@machdyne
Copy link
Owner

The CDC baudrate is set in tusb_config.h and is 115200 by default.

If you plug the modem into a Linux computer, it will be /dev/ttyACMx if the device is CDC.

However, from the USB description it looks like it is not CDC, and may use a custom protocol that would require writing a specific driver.

That would be more complicated to implement, I believe the details of the protocol are available here:

https://github.com/torvalds/linux/blob/master/drivers/usb/serial/ftdi_sio.c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants