Installing the USB Driver on Windows & Serial Debugging

Figures as soon as I ask for help I get it working. Turns out it was the USB cable.

2 Likes

@Craigjones
Were you able to resolve the issue by changing the USB cable as well?

No matter what I try on Windows 7 Professional 32-bit, I cannot get my serial over USB to work for debugging programs.

I can only make it work when the Core is in listening mode (slow blue flash).

Any time I try to use the Arduino IDE’s serial monitor or Tera Term VT, it complains that the port is in use already. Putty just dings at me and doesn’t work for squat even with my FTDI Friend. FTDI friend works on Arduino IDE serial monitor and Tera Term VT pretty well!

Another thing I noticed with the USB serial driver. When my Core is connected to USB and the spark_core.inf driver is loaded, if I plug in a USB drive my system will not recognize it until I unplug my Core. Likewise if I load the USB drive, and then plug in the core and THEN unplug the USB drive, windows will not update and show me that the USB drive has been removed until I unplug the core. It’s like the spark_core.inf driver is completely taking over the usb. What’s the deal with this?

BTW I have ditched the Spark Core cable and have been using a different one just in case that is the problem. I don’t think so though because it does work in listening mode. FWIW, my spark core cable never worked in listening mode.

I have also tried disabling the spark_core.inf driver after booting the core, opening Tera Term VT, and then re-enabling the driver. However… for some reason when I go to disable the driver, it just hangs forever with the hour glass symbol. If I disconnect the core from my computer the hour glass goes away and the driver gets disabled. So that’s not going to be a good work around for me :smile:

I have also tried delaying the beginning of Serial.begin(9600); for 20 seconds, at least I think it might work… but for the life of me today I cannot get my core re-flashed from the cloud to try it. It always hangs at some point during the programming and I get a solid magenta or LED off. After a minute it will reset itself and boot with the last known good app.

Here’s the 20s delayed app:

int counter = 0;
bool serial_enabled = false;
uint32_t lastTime = millis();
void setup()
{
  pinMode(D7,OUTPUT);
}
    
void loop() 
{
  if(millis() - lastTime > 20000) {
    Serial.begin(9600);    // open serial over USB
    serial_enabled = true; // enabled! Let's start logging!!
  }
  if(serial_enabled) { 
    Serial.print("Spark Core says Hello over USB! ");
    Serial.println(counter++);
  }
  digitalWrite(D7,HIGH);
  delay(100);
  digitalWrite(D7,LOW);
  delay(100);
}

I’d love some help getting Serial over USB working!

@BDub on Win8 I have been fairly lucky with this. If I do the following…

  • Flash my spark over the wifi

  • UNPLUG the spark to kill the COM driver, then plug it back in

  • Run my spark program and wait till AFTER the serial port is begun from the code, then the COM port shows up, and putty is fine.

  • Use putty to watch whatever I need to

  • When I am ready for another run, I need to UNPLUG the Spark, and close putty completely - then continue

On another note, this serial driver really needs to be signed. It not only looks unprofessional, but will prevent a lot of users from ever using the Spark… many potential users are not Admins on their systems, and installing an unsigned driver is impossible. And this is not onlt DVE users, but some potential END users who might need to use the USB to config Wifi.

Ken

Ok I FINALLY have it working… seriously this feature needs to be looked at >.>

What I have to do is a bit hacky, but it works.

  1. Close Serial Terminal Software (I’m using Tera Term VT 4.80)
  2. Flash Core with code that enables Serial in setup(), but waits for a character before it continues.
  3. Wait till Core reboots and connects to the Cloud (Breathing Cyan)
  4. Open Serial Terminal Software.
  5. Open a Serial Connection at the correct baud, 8 bits, no parity, 1 stop, no flow control.
  6. Press Enter within 15 seconds of Cyan LED first Breath.
  7. Bingo bango, kiss the screen! You have serial debugging over USB. Have a :beer: or :beers:


uint32_t counter = 0;
void setup()
{
  Serial.begin(9600);         // Open serial over USB.
  while(!Serial.available()); // Just chill until we Rx a character. Don't chill
  pinMode(D7,OUTPUT);         // more than 15 seconds or the core will choke.
}
    
void loop() 
{
  Serial.print("Spark Core says Hello over USB! ");
  Serial.println(counter++);
  digitalWrite(D7,HIGH);
  delay(500);
  digitalWrite(D7,LOW);
  delay(500);
}

I initially had a timer and state machine in the main loop, but this is way more efficient and has no effect on the user code once you are out of setup(). I don’t like to have to do this, but I’m happy that I can ditch my FTDI friend for the moment.

1 Like

@BDub - w00t! Awesome. Glad you have it running!

You and me both @Soulhuntre … and I’m running my core off of my cellphone as a wifi hotspot and it’s fast as hell!

Sorry I’m late to this thread! In case this helps someone: I can’t tell you how many times I tried to get serial working in putty before I realized I was on the wrong screen:

Make sure you’re on the main ‘connections’ screen that opens by default, and not the “serial” line from the nav-tree on the left. :slight_smile:

2 Likes

[quote=“Dave, post:29, topic:882”]
Make sure you’re on the main ‘connections’ screen that opens by default, and not the “serial” line from the nav-tree on the left.[/quote]
Whhaaaaaaaaaaa??? x_0`

Thanks @Dave !!!

4 Likes

There have still been something weird going on, because I know how to make connection and even used CoolTerm that scans ports itself to check it wasn’t error in KiTTY’s settings.

Last Friday (when I received my Cores) I didn’t get Serial connection with original driver, no matter what setting I used. (Except when Core was blinking blue listening mode).

Few days ago I tried again and tried to uninstall and reinstall driver. It didn’t work until I removed everyline refering to “serenum” from driver.inf and installing that. It started to work perfectly with same codes and settings.

Today I uninstalled my hacked driver and installed original one and now it works too. There is nothing different on my end, so is backend in spark.io/build updated in last few days, or was it some ghost in my Windows?

If you were able to get the Serial connection during listening mode, you should definitely be able to get it during your code. Are you waiting until the LED goes ‘breathing cyan’ to open the serial connection?

Yes, that is when Core appears in Device manager. When there was problems, it did appear Device manager and CoolTerm was able to detect it with scan. Error messages were “Access denied”, “Serial port COM3 already in use” or similar depending on program.

I now even took my laptop and tried to reproduce the problem by doing everything like the first time, but I works just fine. So it must have been either random hiccup with Windows or the firmware source outside the user app is updated.

I have now no clue why modded driver.inf did work, because I did try few different mods in it before it started to work. That means it can’t have been driver cache (and I had checked “Delete the driver software for this device” while reinstalling drivers).

User app in the Core:

void setup() {
    Serial.begin(9600);
}

void loop() {
    Serial.println((int)millis()/1000);
    delay(1000);
}

I don’t know why you modded driver worked either, but take a lesson from all of my headbanging-on-desk and check out my example above:

The reason the port is in use already is because your main loop is banging away on the TX sending chars to the computer. If you delay that response like I did in my example, your port will open. You just send a character (press ENTER) and it will start your code up. :smile:

But the thing is, I don’t need any delay. Now it even have the original non-modded driver installed and I’m able to connect, disconnect and reconnect anytime.

Well damn, what are you sitting around here for then? … go build something! :slight_smile: wish mine did that

2 Likes

That is a really good trick - thank you @BDub. Adding the SPARK_WLAN_Loop(); statement takes all the fiddle out of timing when to open the terminal window. I see that this is quite an old post but I must have missed it and kept using the old “wait for the flash and hit go”. This is a huge improvement. Great stuff. Should it be in "Getting Started?"
EDit: I mean the getting started section of the web site - I know it is in the getting started bit of the forum.

2 Likes

Yes I agree we should probably add references to this in the documentation. I think mac users don’t need it, but not everyone is a mac user :wink:

1 Like

Hey @BDub Can you help me out how to configure spark core on PC for fedora 18?

Hi @anirudh! It should be similar to any other Linux distribution… check out this thread and let me know if you can get it connected. Once you do you can type i to get the Core’s ID (and verify if Serial comms are working), and w to enter the SSID and security/password details.

Yeah it got connected to the serial port and when i pressed [w] in the terminal the SSID and password got detected and when I presses [i] i got the core id but the LED is flashing only blue light and I not even able to claim the core also what to do.

Thanks in advance @BDub