Panda II - Help w/ user input

I am using the Panda II to help develop a product that will use the USBizi 100 chipset. The modules will interact with a WIndows host program (not mine) via TCP/IP, and need no user configuration other than entry of the host program’s computer IP address and the port it listens on.

How might you suggest I enable this? I was thinking easiest would be to implement the USB virtual serial port and coding a function that allows basic commands and IP entry via Hyperterminal. However I’m also considering designing for future program updates that can be done by the user. If I implement the code in the “USB Debugging with Virtual COM Channel,” is there a way I can provide for a user to easily update the device with a downloaded program update? Or perhaps a way that I can program my device to “phone home” securely to obtain an update on its own via its TCP/IP connection and the internet?

Thanks for any advice that you can provide!

Scott

A little switch in your product can select a debug mode vs user mode, which changes what USB does.

Hi Scott, welcome to the forum!

Further to what Gus says…

So lets just clarify, you have a device that will get configured somehow, to talk to a specific IP address and port that the specific PC app listens on. That’s the only configuration it needs, and you are looking for possible ways to set that configuration information when the device is first “commissioned”. Is that right?

From what you’ve said, I am assuming that the network will use DHCP, so the device won’t need to have it’s network settings configured?

Will the PC’s network address ever change? Perhaps you should be looking at something like DNS to make sure that this doesn’t cause you an issue.

On to settings. CDC would work; you could have a simple app that communicates over the serial channel and writes the appropriate data to a storage location (SD card perhaps?) where you simply send a command (for example WRITE_MY_DATA) and when you get the expected response (WHAT_DATA?) you then push the IP address or name and port through.

Perhaps a simpler way is you could just have the simple program that writes the configuration info needed onto an SD card, and that is then loaded into the Panda at runtime. Almost the same amount of PC code to achieve this and you don’t need to do a “bootloader” on the Fez to handle the serial comms (although it’s probably not that significant a challenge).

The other thing you talked about was updating over the network; that’s certainly possible - search for IFU or In-field update and you’ll find what you need (and look at Skewworks Pyxis2 for a great implementation example). That’d allow you to update your app at any point - though how you’d manage that across many devices along with the actual settings might be challenging.

hope that helps

Gus, is there a code snippet to demonstrate? I can easily check a pin state during initialization, but not sure how to toggle user mode/debug mode in the application code…? I presume that “user mode” would be CDC virtual serial, and “debug mode” would be as it is now - only for me during development with Visual C#?

Thanks!

Scott

The switch will be connected on mode pin, which selects between serial and USB debugging. You are not using serial debugging so just lease the serial port unconnected with rx pin pulled up of down.

Thanks :slight_smile:

Correct. And as you surmised, the settings must “stick” after power-down, so either via EEPROM or SD or similar.

I have to be prepared for either.

It’s possible, but not likely often. The host program is a front-end to a flight simulation application, and a requirement is for the host machine to have a fixed IP.

KInd of what I envisioned. I could provide for updating my products network information if needed (e.g. hard IP) as well.

That was my other thought. However there will be 3 or 4 of my modules running, and each will need this functionality. If user has DHCP, then an SD card would work well, as the same server config would be used by each device. But if they need a fixed IP, it’s a bit more challenging this way.

Will look into this. I’m still unclear as to HOW to implement virtual serial via the USB while being able to debug…but Gus is trying to help on that front :slight_smile:

Thanks!

Scott

I see, but what about debugging during development? If I want to test the virtual serial usb functionality with a host utility I write, do I have to give up debugging? I suppose I could connect the serial port to a separate USB-to-serial converter and debug via that channel?

Thanks!

Scott

You need to test this couple times, which you can test using serial debugging.

IFU is something you’ll want, if you ever want to update your codebase. That will allow your hardware to update itself from over the network.

This sounds cool, a flight sim related project always interests me.