NRF52840 as USB peripheral and USB host.

Hi Everyone,

                 I am using NRF52840 in my project and working on sdk 17.0.2. My application includes the following:-

1) Send aquired data from sensors to the desktop via USB.

2) Receive data from the desktop application via USB.

We are also using MAX3421E IC which is connected to NRF52840 via SPI interface. This IC is basically a USB Interface IC which can be configured as USB Peripheral/Host Controller with SPI Interface.

I am new to this USB development. I know I will have to include libraries of MAX3421e IC and configure it via SPI through the NRF52840. I am confused on the part of how will the data be sent from nrf52840 to the desktop application and vice versa. Do I need to add any peripheral libraries for nrf52840 so that it can send the data???

Or MAX342 will do the sending part. I am reading the documentation also but quite confused on the working. 

Can anyone please help?

Thank you,

Snehal.

Parents
  • Hi,

    For USB, I would suggest starting with something simple like the USB CDC ACM Example. Your board should then show up as a virtual COM port on your PC when the USB is connected. Next step can be to integrate the SPI sensor and relay the data to the COM port.

    Best regards,

    Vidar 

  • Hi Vidar, 

           Will I be able to debug and flash the code into device after implementing  USB CDC ACM Example?

    What is the difference between USB class storage module ,USB CDC ACM & usbd_ble_uart? Which one will be best suited for my application?

    I am also having an external NOR flash attached to nrf52840 via SPI. To mount the file system on the NOR flash I am going to use littlefs library. The main goal is that whenever the device is plugged into the laptop, we should be able to see the device as a drive and we should be able to access the files from the external flash just like we access any pendrive when it is attached to the laptop.

    Will USB MSC code work for above application?

    Thanks,

    Snehal

  • Hi Snehal,

    I suggest you try the examples to see how they work. If you want your USB to show up as a mass storage device (like a USB flash drive) you should use the USB MSC Example which enables the USB Mass Storage Class.

  • Hi Vidar,

    There are 2 cases in my project:-

    1) ID accessory(pen drive) ----> NRF52840.

    In case 1 NRF52840 should act as a USB host and detect the ID accessory as well as do some data transfer. As nrf sdk does not support USB host operation, we are going to use MAX3421. 

    2)NRF52840 ----> Desktop

    In case 2 NRF52840 will be connected to the desktop and it should be detected as a drive on the desktop. Here Nor flash is also attached to the NRF52840 where sensor data will be saved. I will be mounting file system on this NOR flash. So when nrf52840 is connected to the desktop, the user should be able to see the files from the flash.

    What USB drivers do I need to use in Case 1 & Case 2 respectively. This is my confusion. Please help.

    Thanks,

    Snehal.

Reply
  • Hi Vidar,

    There are 2 cases in my project:-

    1) ID accessory(pen drive) ----> NRF52840.

    In case 1 NRF52840 should act as a USB host and detect the ID accessory as well as do some data transfer. As nrf sdk does not support USB host operation, we are going to use MAX3421. 

    2)NRF52840 ----> Desktop

    In case 2 NRF52840 will be connected to the desktop and it should be detected as a drive on the desktop. Here Nor flash is also attached to the NRF52840 where sensor data will be saved. I will be mounting file system on this NOR flash. So when nrf52840 is connected to the desktop, the user should be able to see the files from the flash.

    What USB drivers do I need to use in Case 1 & Case 2 respectively. This is my confusion. Please help.

    Thanks,

    Snehal.

Children
Related