1

The USB host example sent with the kit is only for reading files not sending/receiving serial data. I searched Microchip, forums and google to no avail. As I am sure many of you know the microchip USB libraries are notoriously difficult and I have been unable to make any measurable progress. I tried the microchip USB configuration utility and got errors plus no better understanding of how it works. An example, even a simple byte echo program with the PIC being the HOST should be enough to get me going.

Revision: Let me clear things up a little. Big picture - I am attempting to use the PIC24F starter kit to talk to a TRF7960A EVM board from TI. The TRF7960 board is an RFID reader that communicates via a USB port. I need to be able to send it string commands such as "0109000304F0000000" and then receive similar messages back from the TRF7960. This is why I need to be able to have the PIC24F operate as a host and send the serial data. I likely use a poor choice of words when I mentioned 'serial emulator' but I wasn't sure what else to call it. Hope this helps...

Revision2: The PIC is the master. I will be initializing the RFID reader on power up. When RFID tags are within range the RFID reader will asynchronously send the data over the USB.The data will be a string representing the UID from the RFID chip. The program will have to detect the USB traffic and interrupt to process it. I suppose I could poll for the data but I worry that I could miss it. I will then take that data and decide what to do based on the other inputs. It would be great if the example put the data on the LCD so I could verify that step is working correctly. The PIC will also be reading other inputs such as button pushes, PWM and A/D channels. I will collect all the data then output it over the SPI or UART to a radio at periodic intervals.

Once again...Many thanks.

D.R.
  • 11
  • 3
  • It is not clear what you are trying to do. Do you want to send and receive RS-232 serial data? The host demo code in the MLA makes the PIC a USB host. What USB device are you trying to host? What errors are you receiving? – jolati Oct 13 '15 at 22:34
  • Your revision helps but by what means will you initiate a USB exchange with the RFID reader? How will you process the response? Is there a keyboard & display? In other words - how do you communicate with the PIC? – jolati Oct 14 '15 at 04:42
  • The USB master initiates all exchanges with the hosted device so once you're communicating the device will only send data in response to your command, which you can then process before requesting the next one. That said, the demos supply several examples of how the USB Framework is applied. This saves you writing the host from the ground up, but you will have to tailor it to the transfer requirements of your particular device. – jolati Oct 14 '15 at 13:34
  • That doesnt appear to be what I have seen in my testing. I connected the RFID reader to my laptop via USB. I started my terminal program (Putty) and sent the configuration strings to the RFID board. I then physically moved the reader over an RFID tag and the RFID reader sent the UID of the tag to the laptop and it showed up on my screen. I repeated the motion and I was able to repeatedly scan(read) the RFID tag everything I moved it over the tag. Each time the RFID reader would fire off a message over the USB to my laptop without my laptop having to request the additional packets. – D.R. Oct 14 '15 at 14:58
  • I feel like there is something that I don't understand about the process based on your previous statements. That's another reason I was really hoping someone could point me to an example. I cant be the first person to try this. – D.R. Oct 14 '15 at 15:00
  • Sounds like your USB device presents as a CDC. There is a CDC host demo at microchip\mla\v2014_07_22\apps\usb\host\cdc_basic\firmware\src. Have you tried that? – jolati Oct 14 '15 at 15:27
  • FWIW there is a function USBHostCDC_Api_Send_OUT_Data in usb_host_cdc_interface.c though it is not called by the demo. – jolati Oct 14 '15 at 21:32

1 Answers1

0

What you're looking for doesn't exist. Serial emulation is performed by USB devices, not hosts. Take a look in USB device stack; there was a CDC example there last time I checked.

Oleg Mazurov
  • 497
  • 5
  • 10