Digistump Forums

The DigiX => DigiX Support => Topic started by: Kaeltis on January 16, 2014, 01:46:38 pm

Title: [FIXED!] Weird Serial/WiFi issues
Post by: Kaeltis on January 16, 2014, 01:46:38 pm
I'm having a weird issue with the serial port.

After uploading a sketch with serial output enabled, the serial monitor doesn't show anything at all,
I can only get it to work by deleting the DigiX COM port from the device manager, unplugging the DigiX and plugging it in again, but only until I upload a new sketch.

I'm using the DigiX Hardware files and DigiX Drivers on Windows 8.1 x64

Also, the WiFi module aswell only seems to work together with

Code: [Select]
//DigiX trick - since we are on serial over USB wait for character to be entered in serial terminal
while(!Serial.available()){
    Serial.println("Enter any key to begin");
    delay(1000);
  }

in setup() and this procedure. As soon as I remove the "DigiX trick", it doesn't  respond anymore (using the "ServerExample" or the arduino_to_thingspeak example) except for it's builtin webinterface.
Title: Re: Weird Serial/WiFi issues
Post by: digistump on January 17, 2014, 09:58:39 pm
The first issue I've seen too with Arduino IDE 1.5.5 in general (not DigiX specific) - and for that reason don't have a fix, it just went away the next day - do you see it with other boards in the same IDE if you have others?

For the DigiX try putting a delay say delay(1000); (or more) at the start where the Serial waiting was - the wifi module might not be starting fully before you try to talk to it.
Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on January 18, 2014, 03:19:44 am
I added a delay of 5000ms to setup, now it works, thanks :)

I'll try an old Arduino Mega 2560 later and see how that behaves.

Edit: no serial issues with the Mega 2560, maybe it's caused by the whole flash erasing, writing and board reseting process the newer boards use.
Title: Re: Weird Serial/WiFi issues
Post by: digistump on January 19, 2014, 01:17:40 am
Do you have a second machine you can test the serial thing on? I see no way it could be the device - but it'd be nice to confirm if it was the IDE/computer.
Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on January 19, 2014, 06:42:09 am
Old MacBook Pro (late 2007) with OS X Mavericks - Serial working perfectly, can upload sketches and directly access the Serial Monitor to get the output.

Same PC as Windows 8.1 with Linux Mint 16 x64 - similar serial problems as on windows

Gonna try Win 7 x64 on a different Machine later
Edit: exactly the same serial problems there.
Title: Re: Weird Serial/WiFi issues
Post by: digistump on January 19, 2014, 10:04:12 pm
This is just strange - obviously not a hardware issue, serial works for me on many win8, win8.1, and win7 machines.... is there a common program on these machines that could be interfering? that's all I can think of...
Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on January 20, 2014, 03:47:42 am
I have no clue, especially as there are similar problems in a clean linux environment.  :-\
Are you using Beta 1.5.5 or 1.5.5-R2?

I'll do a clean windows install the next couple of days, maybe things behave different then.

Just to make sure, when installing the IDE, is this the correct order for a x64 system?

One thing i noticed, when you go to "<arduino installation folder>\hardware\tools" and run "listComPorts.exe" the program shows all COM ports but then crashes with the following message:
(http://i.imgur.com/mva0Air.png)
(it shows the DigiX COM port for just a moment after i click the OK button)

Maybe its caused by the german language of my OS? Can anyone confirm that?
Title: Re: Weird Serial/WiFi issues
Post by: gogol on January 20, 2014, 07:35:15 am
I can confirm, that it is running under german versions of

It runs as well under several Ubuntus 32/64 10.04, 12.04, 13.10 and OpenSuse 13.1


Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on January 20, 2014, 07:37:32 am
Do you get that error message when running listComPorts?
Title: Re: Weird Serial/WiFi issues
Post by: gogol on January 20, 2014, 07:55:35 am
no, i receive a complete list without any error!
Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on January 20, 2014, 07:57:31 am
So this might be the possible cause of the problem, can anyone tell me why this is happening?
Title: Re: Weird Serial/WiFi issues
Post by: gogol on January 20, 2014, 08:27:31 am
https://github.com/arduino/Arduino/issues/1573
Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on January 20, 2014, 08:30:47 am
Strange, so this should already be fixed? So why is it still broken?  :o
Title: Re: Weird Serial/WiFi issues
Post by: gogol on January 20, 2014, 08:38:14 am
the MD5 sum of my listcomports.exe is:

5330b7080dde031656c83c3a8cdd93c7 listcomports.exe

if you have no windows version of md5sums, you can get it there:

http://support.microsoft.com/kb/841290 (http://support.microsoft.com/kb/841290)
Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on January 20, 2014, 08:57:21 am
Thanks, have the same checksum here

also tried compiling the most recent version from git - same error
(https://github.com/todbot/usbSearch)
Title: Re: Weird Serial/WiFi issues
Post by: digistump on January 20, 2014, 11:25:06 pm
I haven't tried 1.5.5-R2 yet - gogol are you using 1.5.5 or 1.5.5-R2?
Title: Re: Weird Serial/WiFi issues
Post by: gogol on January 21, 2014, 12:51:33 am
@digistump: I have on one box a 1.5.5R2 and verified the md5-checksum:  Its just the same!

@Kaeltis:

The usual way, searching the internet for "windows" "80010005" and perhaps "VBS"
leads to many type mismatch-errors.

I expect, that you have an device, where an NULL error is returned instead of some information, listcomports expects.


I really hate the way Arduino has implemented the solution with the two different VID/PID entries, depending in which state the DUE/DigiX is.

When a program is running, the DigiX has "2341:003E" and an associated COM-Port, e.g. COM10.  When you now try to upload a new sketch, the only thing COM10 is used, is to trigger an erase followed by an reset, so that the CPU is starting in SAM-BA mode. In that case the VID/PID pair is: 03EB:6124, where Atmel is the owner of 03EB.  For example on two of my boxes the DigiX is recognized as LEGO NXT brick in firmware update mode, because i have installed the LEGO-driver there.

As Windows reserves for each device an unique device name, 03EB:6124 will be recognized as e.g. COM14.  That will change, when it is connected next time to another USB port!
So Arduino searches with listcomports.exe the devices, and takes the first one, it finds which has the VID/PID 03EB:6124.

Awful.  When I tried to compare some issues between real DUE and  two DigiX, my sketch went several times to the wrong device, when I have not disconnected the others before :-(

So I really like, what I am seeing in JTAG possibilities: http://digistump.com/board/index.php/topic,1275.0.html (http://digistump.com/board/index.php/topic,1275.0.html)

Here each device is tied to one serial port, which will even not go away, when the DigiX reboots!  So it is very stable to the programming host!
Furthermore you need no fancy USB-serial port checking in the firmware, as the Original DUE firmware does every loop.  You are able to reprogram a running device without any problem.
When you wish to use the USB port for your own programs, the port is 100% yours, you have not to take care, what to core firmware does.

Maybe the one or other will join, working on that way.


Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on January 21, 2014, 05:04:13 am
I deleted all COM ports from the device manager but it's still crashing  ???

(http://i.imgur.com/gWR6tgq.png)

I also tried disconnecting all USB devices with the same result.
Title: Re: Weird Serial/WiFi issues
Post by: balin on January 21, 2014, 02:33:38 pm
I have the same problem like Kaeltis. I also get the same error msg in listcomports.exe

Im using arduino 1.5.5 and your addon file 0.7
Title: Re: Weird Serial/WiFi issues
Post by: gogol on January 22, 2014, 12:02:43 am
@balin:
That is just a problem with listcomports.exe and your specific hardware/software situation.  The digistump addons don't play any role at this time.
I expect, that

@Kaeltis:  I don't see a recent change in the github repository!  So it looks like, that someone@arduino fixed something, but has not put it back to that repo.
If you have a chance to see the change, which was made for  1.5.4r2, you might see similar code situations, which need also an fix!


Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on January 22, 2014, 03:08:03 am
This is the change that should have fixed this:

https://github.com/todbot/usbSearch/commit/d78dc8150a8ad15c0a59e6b4610385c86618bbf7
Title: Re: Weird Serial/WiFi issues
Post by: balin on January 22, 2014, 03:45:56 am
Well, its not just listcomport... i cant get the digix to answer me on the serial usb port. I uploaded a sketch and get no answer on the com port.

When i try the serial0 port i get a answer but i tried the serverexample and after i send a key its just says Starting and nothing happens.
Title: Re: Weird Serial/WiFi issues
Post by: gogol on January 22, 2014, 04:41:14 am
This is the change that should have fixed this:
https://github.com/todbot/usbSearch/commit/d78dc8150a8ad15c0a59e6b4610385c86618bbf7

Thanks!  I have overseen, that this is so old!  However, that shows, that really NULL was causing that issue.

What happens, when you enter  "mode" on the command line?
With DigiX plugged in and with Digix not connected?

Looking to the code

Code: [Select]
        dhGetValue(L"%s", &name, objDevice, L".Name");
        dhGetValue(L"%s", &pnpid, objDevice, L".PnPDeviceID");
                                               
        if(verbose>1) printf("'%s'.\n", name);
        if( name != NULL && ((match = strstr( name, "(COM" )) != NULL) ) { // look for "(COM23)"
            // 'Manufacturuer' can be null, so only get it if we need it
            dhGetValue(L"%s", &manu, objDevice, L".Manufacturer");
            port_count++;
            char* comname = strtok( match, "()");
            printf("%s - %s - %s\n",comname, manu, pnpid);
            dhFreeString(manu);
        }
       
        dhFreeString(name);
        dhFreeString(pnpid);

I would write it as:

Code: [Select]
       
        dhGetValue(L"%s", &name, objDevice, L".Name");
                                               
        if(verbose>1) printf("'%s'.\n", name);
        if( name != NULL && ((match = strstr( name, "(COM" )) != NULL) ) { // look for "(COM23)"
            // 'Manufacturuer' can be null, so only get it if we need it
            dhGetValue(L"%s", &manu, objDevice, L".Manufacturer");
            dhGetValue(L"%s", &pnpid, objDevice, L".PnPDeviceID");
            port_count++;
            char* comname = strtok( match, "()");
            printf("%s - %s - %s\n",comname, manu, pnpid);
            dhFreeString(manu);
            dhFreeString(pnpid);
        }
        dhFreeString(name);   

it seems, that they decided, to query only the manufacturer, when the devicename matches "COM"-ports.  By reading the comment, it looks like, that there are devices out, which may have no manufacturer entry.
So I think, that querying pnpid should go inside the conditional part as well, as its not needed outside. However, if that is the problem, I have no clue.

I just remembered a tool, I found longer time ago, which lists com-ports on several ways: http://www.naughter.com/enumser.html

what is that tool telling?
Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on January 22, 2014, 04:47:42 am
I recompiled the code with your modification, but it still throws the same error.
I don't know much about C, but it only compiles if i remove "-std=c99" from the makefile (even the original code from github), so the code seems to violate some ISO standards.
(http://i.imgur.com/osTStQf.png)

mode - no DigiX:
(http://i.imgur.com/wFTUqvq.png)

mode - with DigiX:
(http://i.imgur.com/eqXbbeF.png)

EnumSer - no DigiX:
Quote
CreateFile method reports
COM1
QueryDosDevice method reports
COM1
GetDefaultCommConfig method reports
COM1
Device Manager (SetupAPI - GUID_DEVINTERFACE_COMPORT) reports
COM1 <Kommunikationsanschluss>
Device Manager (SetupAPI - Ports Device information set) reports
COM1 <Kommunikationsanschluss>
EnumPorts method reports
COM3
COM4
COM1
COM2
COM5
COM6
COM7
COM8
COM9
COM10
COM11
WMI method reports
COM1 <Kommunikationsanschluss (COM1)>
ComDB method reports
CEnumerateSerial::UsingComDB failed, Error:5
Registry method reports
COM1

EnumSer - with DigiX:
Quote
CreateFile method reports
COM1
COM4
QueryDosDevice method reports
COM1
COM4
GetDefaultCommConfig method reports
COM1
COM4
Device Manager (SetupAPI - GUID_DEVINTERFACE_COMPORT) reports
COM1 <Kommunikationsanschluss>
Device Manager (SetupAPI - Ports Device information set) reports
COM1 <Kommunikationsanschluss>
COM4 <Bossa Program Port>
EnumPorts method reports
COM3
COM4
COM1
COM2
COM5
COM6
COM7
COM8
COM9
COM10
COM11
WMI method reports
COM1 <Kommunikationsanschluss (COM1)>
COM4 <Bossa Program Port (COM4)>
ComDB method reports
CEnumerateSerial::UsingComDB failed, Error:5
Registry method reports
COM1
COM4
Title: Re: Weird Serial/WiFi issues
Post by: gogol on January 22, 2014, 07:14:07 am
Almost clueless.

The only thing, I can imagine, is to reduce the printf statement like:
Code: [Select]
printf("%s \n",comname);and remove the two dhGetValue statements.

When the error still exists, it must be something in the disphelper-library.

On my systems, where the program works, the output of EnumSer is similar. Especially I receive the same error
UsingComDB failed, Error:5

Code: [Select]
CreateFile method reports
COM1
COM2
COM12
QueryDosDevice method reports
COM1
COM2
COM12
GetDefaultCommConfig method reports
COM1
COM2
COM12
Device Manager (SetupAPI - GUID_DEVINTERFACE_COMPORT) reports
COM1 <Kommunikationsanschluss>
COM2 <USB-SERIAL CH340>
Device Manager (SetupAPI - Ports Device information set) reports
COM1 <Kommunikationsanschluss>
COM2 <USB-SERIAL CH340>
COM12 <Bossa Program Port>
EnumPorts method reports
COM1
COM2
COM4
COM5
COM6
COM7
COM8
COM9
COM10
COM11
COM12
COM13
COM14
COM15
COM16
COM17
COM18
COM19
COM20
COM21
COM22
COM23
COM3
WMI method reports
COM1 <Kommunikationsanschluss (COM1)>
COM12 <Bossa Program Port (COM12)>
ComDB method reports
CEnumerateSerial::UsingComDB failed, Error:5
Registry method reports
COM1
COM2
COM12


Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on January 22, 2014, 07:38:03 am
I started stripping parts from the code,

Code: [Select]
    FOR_EACH(objDevice, colDevices, NULL) {
       
        char* name = NULL;
        char* match;

        dhGetValue(L"%s", &name,  objDevice, L".Name");
         
/*  
        if( name != NULL && ((match = strstr( name, "(COM" )) != NULL) ) { // look for "(COM23)"
            port_count++;
            char* comname = strtok( match, "()");
printf("%s \n",comname);
        }
       
*/

        dhFreeString(name);
       
    } NEXT(objDevice);

This STILL throws that error, but only until i remove

Code: [Select]
dhGetValue(L"%s", &name,  objDevice, L".Name");
So it seems to be this line/method thats causing the problems.

Maybe we need to check "objDevice" before we hand it to that method, to make sure it can handle it, just checking for != NULL doesn't seem to work.
I guess objDevice has to be "instanceof" IDispatch but i really don't know enough about C xD (so this idea might be totally wrong)
Title: Re: Weird Serial/WiFi issues
Post by: gogol on January 22, 2014, 07:56:37 am
OK, but without that line, you can't identify, what is an COM-Port.

Do you have Powershell installed on your system?

This script should do the same enumeration:

Code: [Select]
$colItems = get-wmiobject -class "Win32_PnPEntity" -namespace "root\CIMV2" -computername "."
foreach ($objItem in $colItems) {
  if ( $objItem.Name -like "*COM*" ) {
      write-host "Name: -" $objItem.Name "-"
      write-host "PNP Device ID: " $objItem.PNPDeviceID
      write-host
   }     
}
Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on January 22, 2014, 07:58:36 am
Seems to work perfectly:

(http://i.imgur.com/FRbx8MA.png)

Posted an "official" issue, maybe someone there knows how to fix this.
https://github.com/arduino/Arduino/issues/1818 (https://github.com/arduino/Arduino/issues/1818)

Edit: Oh great, the "listComPorts.exe" can't be the cause of my problem because it's disabled and just a leftover  :-\
Title: Re: Weird Serial/WiFi issues
Post by: gogol on January 22, 2014, 08:31:15 am
I have no further idea.

Edit: The interesting question is, if that problem is the same, causing your communication problem, or if there are two independent problems.

Title: Re: Weird Serial/WiFi issues
Post by: balin on January 22, 2014, 09:05:25 am
i cant get the serialusb(serial) working either. So i just use Serial0 for all of my tests and have no problem with it. Maybe you can use this one in the meantime as well for your testing.

And just make sure when you use the wifi module, that the wifi module has the same Baudrate set then you use in wifi.begin(115200); ! This was the fault, why i couldnt get the ServerExample running.
Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on January 22, 2014, 10:31:13 am
Oh well, maybe digistump has some more ideas, but still, thank you very much for your help gogol.

@balin what do you mean with Serial0? Just Serial?
Title: Re: Weird Serial/WiFi issues
Post by: balin on January 22, 2014, 11:22:21 am
(http://i.imgur.com/PxC7pcS.jpg)

no these pins are accessable through the Serial0 command so i just replaced all Serial commands with the Serial0 and used USB to RS232 TTL UART Konverter Module.

The Konverter looks something like that: (http://deih.merchantrunglobal.com/ImageHosting/ViewImage.aspx?GlobalID=1004&MerchantID=11352&ImageID=1702&DisplaySize=-1)
Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on January 22, 2014, 11:29:20 am
Thats a really good idea, even have one of those here  ;D

Settings for Board/Programmer/... are all the same?
Title: Re: Weird Serial/WiFi issues
Post by: balin on January 22, 2014, 11:30:31 am
yes i changed nothing else. used digix standart leave programmer where it was and just replaced the Serial commands.
Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on January 22, 2014, 11:58:08 am
This is the converter i have got here:

(http://i.imgur.com/pLKYnRF.png)

So i just connect GND to GND, 5V to 5V, TX to TX, RX to RX and RESET to RESET?
Whats with that unlabeled pin? Does the 5V work with the 3.3V DigiX?

(dont want to fry anything)
Title: Re: Weird Serial/WiFi issues
Post by: balin on January 22, 2014, 12:00:20 pm
i only used rx (rx to rx) and tx (tx to tx) the konverter should get the power over usb maybe connect gnd (gnd to gnd) also ^^.
Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on January 22, 2014, 01:04:55 pm
Are you uploading the sketch directly or via the converter? cant get it to work oO
Title: Re: Weird Serial/WiFi issues
Post by: balin on January 22, 2014, 02:06:32 pm
im uploading the sketch over the usbserial port.

but to get debug infos and so on im using the Serial0 port, cause my serialusb dont work.
Title: Re: Weird Serial/WiFi issues
Post by: gogol on January 23, 2014, 01:14:47 am
You should not connect this adapter direct to the board, as that has true 5V on RX and TX, because RX and TX are PINs from 8U2
http://arduino.cc/en/Main/USBSerial (http://arduino.cc/en/Main/USBSerial)
If you have the level-shifter, that should do it, maybe digistump will tell something to it!

That adapter, balin showed, has 3.3V on the serial communication lines.

Those adapters use an CP2104 (which is the successor of the CP2102), there are other adapters out, using the FT232R, Maxim and other companies have also some of those out.
The cheap (slow) adapters are available via ebay aliexpress and others for about $2-$4.

If you wish to spent little more money, have a look at the FT232H http://digistump.com/board/index.php/topic,1127.0.html
That device works a multiple devices in one. Its a normal USB-Serial to TTL (like the cheap adapters above) and also and HIGH-speed-serial protocol adapter, speaking native I2C, SPI, JTAG and others.

The big difference between the CORE-USB-to-serial-TTL adapters and the Arduino-Adapter is as following:

The CORE adapters are just a TTL-based UARTs, running the TTL-level protocol on the pins:
(http://commons.wikimedia.org/wiki/File:RS-232_timing.png)
I hope, that the few german words in the picture above are understandable for all readers.

The Arduino-Adapter works different:  The 8U2 (or 16U2 ...) connects with the built-in USB interface and simulates an virtual COM-Port on top of the USB protocol.
This happens over the Abstract Control Model (ACM) , which is defined in the USB Communication Device Class (CDC). Electrical communication is here USB.

On the atmel-CPU is a program running like a proxy:  It accepts data from the virtual USB-COM-Port and output that to the serial port (which is therefore 5V) and via versa.
The proxy-program has some specialities:  For example, when it discovers that the virtual com port is opened and closed with 9600 baud, it triggers the reset of the SAM3X.
The 16U2 on the Arduino DUE works slightly different, as this triggers not only RESET but also ERASE. 

Those Arduinos, which have an FTDI-chip on board, are triggering the reset via the DTR-signal, which is connected via an 100nF capacitor to the reset-line, which is itself pulled high via an resistor.

To avoid the native port programming, you have the following possibilities:

Use an cheap USB-TTL-serial adapter. In that case you have to press ERASE/RESET before each upload yourself

Use something like the above mentioned 8u2/16u2 solution. Make sure that the 8u2/16u2 are running with 3.3V and adapt the Arduino-Firmware.
Unfortunatley the ERASE-Pin is not connected to any breakout-PIN (http://digistump.com/board/index.php/topic,1216.msg5818.html#msg5818 (http://digistump.com/board/index.php/topic,1216.msg5818.html#msg5818))

The third possibility is working via JTAG, which is one task, I am working currently on (http://digistump.com/board/index.php/topic,1275.0.html (http://digistump.com/board/index.php/topic,1275.0.html))





Title: Re: Weird Serial/WiFi issues
Post by: balin on January 23, 2014, 02:50:43 am
Ouh damn i didnt look on the voltage. but gogol is right this one uses 5V on rx tx lvl
Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on January 23, 2014, 10:20:31 am
The FT232H sounds awesome but also awfully complicated as i don't want to break anything and have no knowledge about JTAG at all.

Maybe digistump (or someone else) can find a solution so I can just use the native USB port or maybe you could create a noob-tutorial in the future on how to use the FT232H with the DigiX/Digispark.

For now i'll just wait until my new SSD arrives and see if it works with a fresh windows installation.
Title: Re: Weird Serial/WiFi issues
Post by: balin on January 23, 2014, 10:47:08 am
tell me if the native serial over usb port is working then. cant get it to work on my side either...
Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on January 27, 2014, 01:33:20 pm
After a complete reinstallation of Win 8.1 x64 I still have the same problems, also, "listComPorts.exe" is still crashing.
Title: Re: Weird Serial/WiFi issues
Post by: gogol on January 27, 2014, 11:57:58 pm
Do you have the chance, to boot a linux rescue system from CD/DVD/USB-stick on that box?



Title: Re: Weird Serial/WiFi issues
Post by: digistump on January 28, 2014, 12:14:44 am
Given the reply here: https://github.com/arduino/Arduino/issues/1818 - that you noted it seems listComPorts.exe doesn't play a part in this because it is not in use by the IDE (we don't do anything different than the Due Native Port when it comes to the USB stuff - we only changed the VID/PID)

So it seems like the root of this is the Arduino IDE COM port enumeration code - does that sound right? - which leaves me at a loss because I can't reproduce this issue to even try to fix it (tried 3 machines running 8.1).
Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on January 28, 2014, 02:50:55 am
@gogol
   i tried x64 Ubuntu but the compiler seems broken there because of some missing 32bit librarys, gonna try x86 Ubuntu later.

@digistump
   is there anything I can do to help fixing this problem?
Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on February 08, 2014, 08:48:46 am
Still nothing new? :(
Can barely use it without Serial debugging.
Title: Re: Weird Serial/WiFi issues
Post by: gogol on February 08, 2014, 12:06:35 pm
just to reiterate:

you are able to upload code. That means, that at least in SAM-BA mode the COM-port seems to work.
Which board are you selecting: The DigiX or the native Arduino DUE?
I would recommend for testing purposes to stay with the Arduino DUE variant, as that should be 100% compatible, and we make sure, that the problem has nothing to do with the digistump extensions.
When a sketch is running, and the board is in Arduino mode, is it possible to reset the board, by opening a 1200 8N1 serial connection?

Next try: Is it possible to emulate a keyboard with a simple sketch? Will your host recognize the DigiX as working keyboard?

To the problems with  listComPorts.exe:  Is that failing when the DigiX is in DigiX/Arduino mode AND/OR when it is in SAM-BA mode?

Do you have another DigiX/Arduino Due you can borrow for a test?

Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on February 08, 2014, 03:54:24 pm
I always used the DigiX Setting before, for further testing i'll be using "Arduino Due (Native USB Port)".
Btw. I'm using the MicroUSB cable of my Kindle Touch which is working perfectly with the Kindle and also worked with the DigiX on a MacBook.

Yes, the board resets by opening a 1200 8N1 serial connection.

Using this sketch my mouse pointer jumps up and down just fine (sending keyboard key presses to the computer also works):
Code: [Select]
void setup() {
   Mouse.begin();
}

void loop() {
  Mouse.move(0, -40);
  delay(1000);
  Mouse.move(0, 40);
  delay(1000);
}

listComPorts.exe fails, even if not a single USB device is plugged in.

I don't know anyone with a DigiX/Due  :-\

Thank you so much for still trying to help me :) i hope we can find the problem  ;D

One more thing i noticed, with this sketch
Code: [Select]
int led = 13;

void setup() {
  pinMode(led, OUTPUT);
  SerialUSB.begin(9600);
}

void loop() {
  digitalWrite(led, HIGH);
  SerialUSB.println("1");
  delay(1000);
  digitalWrite(led, LOW);
  SerialUSB.println("0");
  delay(1000);
}

The onboard LED blinks, but as soon as i open the serial monitor the LED keeps its current state and stops blinking, even if i close the monitor again, so the DigiX seems "locked up" in it's current state.
Connecting with a Terminal program (HTerm) doesn't cause this (but with the terminal program i can reset the board with 1200 8N1, so i suppose the program is working).

Without the SerialUSB parts, opening the serial monitor also doesn't cause the "lock up"
Title: Re: Weird Serial/WiFi issues
Post by: gogol on February 09, 2014, 11:26:36 pm
That's very interesting!
I assume, that the program is not longer running, but being stuck somewhere in the serial CDC stack.
The erase/flash however still works, because that is triggered via interrupt  in ./hardware/arduino/sam/cores/arduino/USB/CDC.cpp (http://digistump.com/board/index.php/topic,1297.msg5844.html#msg5844).

The curious thing is here, that only parts of the USB-stack (I assume something like flow-control) is broken, as the the CORE USB functionality is given (SAM-BA upload works).
As parts of the Arduino stack are also working (HID mouse, erase/reset event), the problem seems to be deeper.

Its almost for sure no general Arduino<->Windows 8 problem, as I assume, that others might report that as well.  However, as most Arduino DUE users are using the programming port, there is no such big pressure, to track the errors down. (Assuming, that this problem only occurs between the SAM-USB-stack and Windows, as the programming port of the DUE uses the AVR-USB-stack)

As you had the DigiX running  on a MacBook, I assume, that it worked there ?

Which would be another valuable piece of the puzzle!

I recapitulate (correct me, when some assumptions are wrong)


Some more observations?  Something wrong?


Where are the USB gurus?

Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on February 10, 2014, 03:52:51 am
Yes, on the MacBook everything worked perfectly

Some additions:

Everything else is correct.


(http://i.imgur.com/5qHm6ax.png)
Title: Re: Weird Serial/WiFi issues
Post by: gogol on February 10, 2014, 04:27:13 am
Having the DigiX<->MacBook combination running, we can almost exclude hardware issues.  One try could be external power to the DigiX before USB connection, to make sure, that its not a voltage/power issue.
Its strange, that the COM-Port is not disappearing; that may be related to the listComPorts.exe problem.

What happens, if you connect the DigiX in Arduino-state with running sketch, than you press ERASE and RESET?  Is than the SAM-BA comport appearing and the Arduino COM-port disapperaring?

The SerialUSB library seems to have at least optimization potential: http://forum.arduino.cc/index.php?PHPSESSID=a7oct56k8taij56pn0717u7184&topic=143871.msg1533427#msg1533427
You might want to try the discussed alternative files (even when the initial problem there was RX).

Edit:
You should see in in the device manager an USB-Input Device ("USB-Eingabeger├Ąt") with the Arduino VID_2341 PID_003E.  That should disappear in SAM-BA mode and while RESET is pressed!


Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on February 10, 2014, 04:43:26 am
Yes, ERASE and then RESET removed the Due (COM5) and shows Bossa Program Port (COM4)

I'll try with external power later, as soon as i find my power supply

Edit: yes, the mouse shows up with that hardware ID, while i press RESET it's removed

Edit2: Can't find a suitable power supply atm :\
Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on February 13, 2014, 08:02:18 am
I just noticed more weirdness.

I programmed the DigiX as "Due (Native USB Port)" on COM6 with this Sketch:

Code: [Select]
void setup() {
  SerialUSB.begin(9600);
}

void loop() {
  int sensorValue = analogRead(A0);
  SerialUSB.println(sensorValue);
  delay(1);
}

and got, as i expected, no output in the Serial Monitor.

I then changed all "SerialUSB." to "Serial." and switched the Board Setting to "Digistump DigiX (standard)".
After flashing the program, clicking on the Serial Monitor gave me the error "Board at COM6 is not available".

The COM Port changed from COM6 to COM8, which should be normal as the boards USB-ID thing changed by switching to "DigiX-Mode".

I then selected COM8 in the Arduino IDE and clicked Serial Monitor again (without unplugging the board or anything else) and voila, i got Serial output from the DigiX.

After physically reconnecting the DigiX i'm again getting no output, nothing else changed.

Edit: this is not repeatable, i think this just happened because Windows detected the DigiX as a new device when changing from Due-Mode to DigiX-Mode.

My conclusion: It works every time Windows detects it as a new Device (either by changing the USB-ID or deleting it from device manager) but only until it resets or gets reconnected. But why?
Both the Arduino serial monitor and an external serial programm are working with this method.
The Arduino serial monitor in particular is NOT the cause of this issue, it seems to be a general problem with the Serial connection.

Maybe it's because of the way Windows handles unsigned drivers? When installing the DigiX driver i had to enable unsigned driver mode in the Win8.1 boot menu.
Title: Re: Weird Serial/WiFi issues
Post by: gogol on February 13, 2014, 11:59:11 pm
I can't believe, that this is an general Windows 8.x problem. Otherwise I expect more reports, as well in the Arduino-forum.
There are changes in the Windows USB stack, but not related to those modules/functions the DigiX/Due uses.
http://msdn.microsoft.com/en-us/library/windows/hardware/ff538820%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/hardware/hh406292%28v=vs.85%29.aspx

However I would check with external power provided to the DigiX before making USB connection. At least disabling WiFi.
I have one computer, where the DigiX is unstable while plugged only to USB with Wifi up.

@All readers: If you are using the DigiX with Windows 8 / 8.1  can you try the second sketch from this post: https://digistump.com/board/index.php/topic,1277.msg5939.html#msg5939
Can you report back, if it is working for you, and which version of Windows 8.x (x32/x64) you are using.
Title: Re: Weird Serial/WiFi issues
Post by: dfarrell on February 14, 2014, 04:12:46 pm
I have seen a couple of similar issues on Win7 64. Some I attribute to the multiple USB serial devices I plug in and out. Several Leonardos, DigiX's, Dues etc.  Most issues seem to relate to the two phase enumeration.  One device enumeration when the board is programmed (Atmels ID?) and the other when the serial monitor port enumerates.  I am up to COM44.  You should check the registry HKLM\HARDWARE\DEVICEMAP\SERIALCOM to see how you device enumerates.  You may want to re-install USB drivers for the ports seen in the registry.  I have also had issues with USB hubs, are you using a hub?  Lastly, be sure to always plug in to the same USB connector on your computer/hub.  It makes COM port numbers consistent when you plug in multiple devices.  I also have SAM-BA 2.12 and Atmel studio installed.  They may have updated the USB drivers, I can't tell you for sure. 
Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on March 02, 2014, 03:56:43 am
I'm using always the same usb port directly on my motherboard and only got the DigiX in "SERIALCOMM"

(http://i.imgur.com/11nY3ru.png)

Just installed the new Arduino 1.5.6-r2 BETA but it didn't fix the problem.
Title: Re: Weird Serial/WiFi issues
Post by: Kaeltis on March 09, 2014, 07:33:17 am
O M G i can't believe it, i FINALLY found the cause of my problem!

I tried to use my TI MSP430 Launchpad with Energia, but got an error when trying to upload code: No unused FET found.
I searched for a possible fix and found this thread: http://e2e.ti.com/support/microcontrollers/msp430/f/166/p/290981/1015186.aspx

I disabled the "Logitech Gaming Software" i'm using for my G19s and my G700 and the error was gone.
Being curious, I plugged in my DigiX and finally everything worked, including the Serial Monitor.
(listComPorts.exe still crashes, but doesn't matter as it's not used by the Arduino Software)

Serial output stops in the second i'm enabling the LGS, so it's definitely the cause.

Thank you so much everyone for helping me :)

I'm adding the LGS as a potential cause of problems to a troubleshooting section in the wiki, hope thats ok.
Title: Re: [FIXED!] Weird Serial/WiFi issues
Post by: pitchakorn on May 16, 2019, 02:22:33 am
O M G  :(
ufabet (http://www.ufabet99.vip)