I am calculating numbers that are larger than the scale of "int" type variables. It was explained to that the USB has issues when working with newer operating systems, i.e. Mac OSx, Windows 7, etc. It was easily solved using a delay, but it's not working for "long" type variables. Can anyone help, I'm thinking of just resorting to using an FTDI chip.
Mac r5 Displaying "double" type variables
(14 posts) (4 voices)-
Posted 4 years ago #
-
can you post the offending line of code and the result?
Posted 4 years ago # -
//this is the code below
double value = 0;
void setup() {
}
void loop() {
value+=1.05;
SerialUSB.println(value);
delay(20);
}//this is the offending line of code
//this happens with double, float, and longGoing to build using 'armcompiler' (ARM)
Compiling core...
No libraries to compile.
Compiling the sketch...
Linking...elf section
.data' will not fit in region
ram'
/Applications/MapleIDE.app/Contents/Resources/Java/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/bin/ld: region `ram' overflowed by 1040 bytescollect2: ld returned 1 exit status
//It's an overflowing issue, but I'm thinking this is still related to the limitation of the USB when working w/ a Mac
Posted 4 years ago # -
You probably dont mean to be compiling to RAM. Not only do you have less space to work with, but the code is also stored in volatile memory, which means you loose it during a power-down.
I recommend switching to flash, by selecting "Maple Rev3/5 Flash" from the tools->board menu. This will give you 5 times the amount of program storage space to play with! (~100KB)
The reason you see such a drastic change in program size, is because calling SerialUSB.print on a double/float requires the library to pull in a ton of new code to print decimal numerals.
Posted 4 years ago # -
thank you it did compile and upload....but now nothing is printing in the serial monitor....
Posted 4 years ago # -
hmmm. just tested this code, seems fine. Do you have the correct serial port selected from the tools->serial port menu? sometimes you can force the OS to open up a new serial port number if break the first one. For example, if you open the serial monitor before the device actually jumps to user code (its still in the bootloader) then the OS will fail to open the serial port for the device since you already have it open in the monitor window.
The solution is to wait a few seconds before opening the serial port window after reset.
try this code:
void setup() { waitForButtonPress(); SerialUSB.println("Does this at least print?"); } void loop() { double val = 1.5; SerialUSB.println(val); delay(20); }
Then upload, wait 5 seconds, open the serial monitor, and hit the button. If there is a problem with printing doubles, the first message should print, but not the rest.
Posted 4 years ago # -
Going to build using 'armcompiler' (ARM)
Compiling core...
No libraries to compile.
Compiling the sketch...
Linking...elf section
.data' will not fit in region
ram'
/Applications/MapleIDE.app/Contents/Resources/Java/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/bin/ld: region `ram' overflowed by 1208 bytescollect2: ld returned 1 exit status
------------------------------------------------that is what came up when I did the RAM option, but when I do the FLASH option it prints strings from a completely different program.
Posted 4 years ago # -
Oh, I forgot to mention. If there is a program currently stored in the RAM of the device, it will run that program - RAM takes precedence over FLASH.
To correct the problem, unplug and replug.
Posted 4 years ago # -
ok, now it's running, but it will still not produce decimal values....only integer values.
Posted 4 years ago # -
Are you using the IDE or libmaple from the github repo? A similar problem was reported last week. This bug was fixed in libmaple; not sure if it made it to the IDE yet.
If you're using libmaple, make sure to update it. If you're using the MapleIDE, you can use
sprintf
orgcvt
until 0.0.12 or 0.1.0 come out with this fix.Posted 4 years ago # -
Oh ok. i'm using the IDE, can uSend me the link to the libmaple? And does anyone know when IDE 12 will b released?
Posted 4 years ago # -
MapleIDE/libmaple 0.0.12 will be released when blocking changes are complete. Based on the issue tracker on google code there are only a small handful, however I cannot say when it aught to be out. The team is hard at work though, I'm sure.
There is an article in the docs on how to setup the linux toolchain with libmaple. Similar instructions apply for Windows, though I don't think they're documented. You may be able to download libmaple from the github repo and replace your current MapleIDE's libmaple with it, though I'm not sure how well it will work.
Posted 4 years ago # -
well I just went over the page information, and it says that they come in a bundle. I am not able to calculate "long" or "double" values on my Mac, it states that there is an error and it will not compile.
Posted 4 years ago # -
iRobotGoddard,
I am unable to reproduce your issue using Maple IDE 0.0.11 on OS X 10.6.7, using a Maple Rev 5.
I copy-pasted your code and successfully compiled and uploaded it to Flash, with no region overflowing. When I connect to the Maple using the IDE's serial port monitor, the doubles are printed to 2 decimal digits of accuracy, in keeping with the behavior documented here:
Are you sure you have "LeafLabs Maple Rev 3+ To Flash" selected in the Tools > Board menu, and that the correct serial port was chosen from Tools > Serial Port?
edit: add more info on my config
Posted 4 years ago #
Reply
You must log in to post.