4.1: SerialPort.dll System.ArgumentException
#1
Posted 25 September 2012 - 04:53 PM
#2
Posted 25 September 2012 - 05:50 PM
#3
Posted 26 September 2012 - 02:51 PM
Hi Howie,
COM1 is a special "debug UART" which can only handle 8 data bits if I remember correctly.
Can you try COM2? Looking at the data sheet, it can handle 9 data bits.
Welcome to the Netduino community,
Chris
#4
Posted 26 September 2012 - 03:08 PM
Attached Files
#5
Posted 26 September 2012 - 03:31 PM
#6
Posted 26 September 2012 - 05:05 PM
Hmm, it could also be the requested baud rate...or the combination of even parity with 9 data bits.
The USART code for Netduino Plus is in:
C:\MicroFrameworkPK_v4_2\DeviceCode\Targets\Native\AT91\DeviceCode\AT91_USART
If it's a setting that the microcontroller can support and we don't support it yet, that's something we can also address in an update. [Or if you make the change, please consider contributing it--and everyone can have the update.]
Chris
Hi Chris,
Here's where the exception comes from in the 4.1 code (that matches the firmware I still have on the board):
C:\MicroFrameworkPK_v4_1\DeviceCode\Targets\Native\AT91\DeviceCode\AT91_USART\ATI91_USART.cpp
in the function AT91_USART_Driver::Initialize (the version finally called by the code in the folder you mentioned in the case of the Netduino Plus's AT91 processor):
Lines 98-115:
switch(DataBits)
{
case 5:
USMR |= AT91_USART::US_CHRL_5_BITS;
break;
case 6:
USMR |= AT91_USART::US_CHRL_6_BITS;
break;
case 7:
USMR |= AT91_USART::US_CHRL_7_BITS;
break;
default: // not supported
fRet = FALSE;
//fall through for default
case 8:
USMR |= AT91_USART::US_CHRL_8_BITS;
break;
}
9 data bits will hit the default: case and return false, generating the exception I saw.
I will test a modified Initialize and also add functions to set the 9th bit for certain characters, etc., and contribute them back for anybody else who has similar requirements.
BTW, have you created a solution for loading unmanaged code at runtime as you suggested in this 2010-2011-2012 thread? http://forums.netdui...28-native-code/
Thanks much!
Howie
#7
Posted 29 September 2012 - 10:41 PM
#8
Posted 01 October 2012 - 11:15 PM
...
I will test a modified Initialize and also add functions to set the 9th bit for certain characters, etc., and contribute them back for anybody else who has similar requirements.
BTW, have you created a solution for loading unmanaged code at runtime as you suggested in this 2010-2011-2012 thread? http://forums.netdui...28-native-code/
Thanks much!
Howie
Hello again,
I'm trying to add just a half-dozen functions to do specific things with serial and other hardware; think I can get adequate speed just using C# for the overall framework. Chris, the Adeneo interop post you linked to last year seems to get me tantalizingly close:
http://adeneo-embedd...-framework.html
However, I'm still stuck in a few places.
1. Question: he suggested creating the Visual Studio project in
"PortingKit\Solutions\[Your Solution]\ManagedCode\",
-- so I just created that directory: in my case C:\MicroFrameworkPK_v4_1\Solutions\Serial9\
However, as I worked through his procedure, I found I needed to manually copy over various top-level files like dotnetmf.proj and folders like TinyCLR from another solution. I assumed the Template solution was correct, but he didn't say where they should come from. Do you think he assumes we initially created the solution with the MS SolutionManager he called "flimsy"??
2. A detail about his procedure: he says to edit the .featureproj file to point to the .pe (Portable Executable) file from the Library project -- but in VS2010 at least, there are TWO versions of .pe and other binary files, in two directories named:
bin/Debug/le and
bin/Debug/be .
Googling wasn't too helpful -- I mostly found "le" on French pages ;-) It turns out the choice matters: be is Big-Endian and le is Little-Endian. The ARM defaults to Little-Endian, (though initialization could change it, I'm sure yours doesn't). If you are using a Big-Endian processor, you also need to use Template_be as your model instead of Template, apparently.
3. A request for Chris: would it be possible to post a link to the 4.1 firmware sources again? I only see 4.2 on your Downloads page. Because I had trouble with the USB drivers for the boot re-flash that 4.2 firmware requires, I'd rather not mess with all that just to make these small changes. However, I can't create an image for 4.1 without them, unless perhaps I link to the downloaded object as someone suggested -- but I'd rather have all source.
4. Finally, just to clarify: although MFDeploy says it can do incremental downloads, I haven't found any procedure for that. I'd love to just deploy my small changes linked against the existing image, with or without GUI niceties. However, at this point I plan to link and compile the whole thing; then re-flash following this procedure in the wiki:
http://wiki.netduino...ep-by-step.ashx
If there is an incremental deployment procedure, I'll gladly add a wiki page explaining it, once someone explains it to me ;-)
Cheers!
Howie
#9
Posted 08 October 2012 - 05:29 PM
Just a minor point: trying to compile 4.1 firmware using the ARM RVDS compiler -- by coincidence that's also version 4.1. Unfortunately, the set_context scripts only support RVDS4.0. Here's an attempt to add an RVDS4.1 target, but I'm not sure it's correct. The compile is still giving errors that could relate to incorrect variables OR to the fact I let ARM install to Program Files -- the quotes may be what's screwing up the batch files. Chris, any suggestions? As I promised about the serial, I'll add a wiki page explaining this -- once it's working for me.
Notes about setconf_base.cmd:
- Comparing labels :SET_RVDS_V40_VARS and my new :SET_RVDS_V41_VARS, notice my environment has ARMCC41BIN/INC/LIB set, where the 4.0 version sets RVCT40/BIN/INC/LIB -- I assume that's a change between those ARM compiler versions.
- There is no PK directory tools\ads_v4_1 in the PK directories to match the RVDS_EXT set here -- however, there's also no tools\ads_v4_0 (just tools\ads_v3_1); so I assume it's not needed?
- Note I created a setenv_RVDS4.0.cmd also, but that's trivial (and you can only add one file per post).
Howie
Attached Files
#10
Posted 08 October 2012 - 05:32 PM
Use the setenv_rvds4.1.cmd file with the latest rvds 4.1 and you should be good to go:
c:\microframeworkpk_v4_1>setenv_rvds4.1.cmd "c:\program files\arm"
Chris
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users