Show Posts
Pages: 1 2 3 [4] 5 6 ... 21
46  Products / Arduino Due / Re: ArduinoDUE - FloatingPointVS Integer math on: August 26, 2013, 01:07:13 pm
I also am baffled. That result makes no sense at all. The only way to really answer the question is to have an example though. We'd need to see some code that exhibits this behavior. Off the top of my head I can think of only a couple of possibilities:

1. Have you tested for proper output from both versions? That is, can you verify that both produce the right result?
2. The algorithm used for integer math was terrible compared to the one used for floating point. It is possible to write bad code in any language and at any time. So, make sure your algorithms are efficiently constructed.

Equivalent versions of an algorithm with one coded as integer math and the other FP should show the integer version to be many times faster on a Due.

47  Products / Arduino Due / Re: Why the sketch size and amount of RAM used by DUE is more than MEGA. on: August 26, 2013, 08:44:57 am
There are a variety of reasons. One is that the MEGA uses an 8-bit processor while the Due is 32 bit. Consider the following line:

int someVariable;

How much space does that take up? Usually ints are the size of the processor or 8 bits for the Mega and 32 bits for the Due. However, I think that ints on the mega are actually 16 bit. Still, the exact line of code is at least twice the amount of RAM on the Due as it is on the Mega. This will cause identical code to take up different amounts of RAM depending on which processor you compile it for.

This same thing holds true for other things. For instance, function calls need to place memory addresses on the stack. Memory addresses sizes differ between processors so you will have RAM usage differences.

48  Products / Arduino Due / Re: how to flash atmega16u2 for a arduinoDUE based project on: August 26, 2013, 08:36:43 am
That sounds right to me. You should try it and report back so that other people know what to do and where to find the files in the future.
49  Products / Arduino Due / Re: how to flash atmega16u2 for a arduinoDUE based project on: August 25, 2013, 06:20:58 pm
The arduino is just a conduit. You still have to use avrdude (the program) and it will give you status messages. So, if it tells you that things didn't work then something is wrong. Otherewise, it'll tell you that it did work.
50  Products / Arduino Due / Re: how to flash atmega16u2 for a arduinoDUE based project on: August 25, 2013, 07:26:26 am
hello everyone,
i'm working on project based on Arduino DUE. i've already printed my pcb and now i need to flash the atmega16u2.
according to this guide i shouldd be able to flash it siply connecting to the usb and then execute avrdude.exe from the cmd program(i'm using windows seven), but in my arduino due IDE (1.5.2) i can't find avrdude.conf nor the hex file.
where can i find them?

No, according to that article you need to flash a special sketch to an Uno or Mega and use it as an ISP (or use a normal ISP tool) to connect to a six pin connector on the Due that lets you flash the 16U2 chip. You can't just program that chip through the USB port.
51  Products / Arduino Due / Re: How to write data to internal EEPROM. Arduino due. on: August 14, 2013, 10:08:40 am
How to write data to internal EEPROM.  Arduino due.

Step 1. Put internal EEPROM into the Cortex M3 chip (carefully!)
Step 2. Use it.

In all seriousness, the Due has no EEPROM at all. There is the possibility to store things in the FLASH memory but, since it gets totally erased every time you program the Due, this is not ideal. So, really, if you need EEPROM you've got to put it on a shield.
52  Products / Arduino Due / Re: arduino due vs arduino uno on: August 12, 2013, 07:55:37 pm
Unfortunately the use of double precision floating point variables on a Uno will really slow things down. To make matters worse, division and square roots are long operations in floating point. It sounds like you need precision and that's a problem. If you could deal with loss of precision then switching to 64 bit long integers (using them as fixed point numbers) and using look up tables for the hard functions like sqrt would make things a lot faster. The Due can crunch 32 bit numbers in a single cycle and I believe even has op codes for operations that yield 64 bit numbers. But, it has no floating point support at all.

So, I guess my suggestion is this:

1. If precision is important to you then find a processor that does have an FPU. Some ARM Cortex chips do have FPU. You could probably use a BeagleBone Black or Raspberry Pi.

2. If you can lose some precision then use 64 bit integers. A 64 bit signed integer has a range of about +/- 9,223,372,036,854,775,808. Let's say you know that none of your numbers is ever more than +/- 8000. Then you could easily support 15 digits of precision to the right of the decimal point. That's pretty precise. Just for reference, 32 bit integers are +/- 2,147,483,648 which means if you knew you were going to stay within +/- 2000 you could have 6 digits of decimal precision. That's probably not enough though, is it? If it is then you're in luck because the Due will be really screaming fast.

If you go with #2 then precalculate a look up table of around 1024 or 2048 sqrt values. You won't have to precalculate divisions because they'll be hardware accelerated and you can probably get away with doing powers in a tricky way too. If you only need integer powers then that's pretty easy.
53  Products / Arduino Due / Re: util/delay.h library reference is not working with DUE on: August 12, 2013, 08:15:02 am
The error is correct. util/delay.h is part of the AVR library and the Due is not based on AVR but rather ARM. If the TCS34725 library depends on that AVR header then you will probably have to modify it. There are plenty of delay functions built-in for the Due so you can probably find a way to modify the library to not need any additional headers for delaying.
54  Products / Arduino Due / Re: arduino due vs arduino uno on: August 12, 2013, 08:10:49 am
It is tough to say for sure. But, here is what I can tell you:

1. I'm pretty sure the processor in the Uno will do 1 instruction per clock (for most instructions).
2. It runs at 16MHz.
3. It is 8 bit

This means that the Uno can execute 16 million 8 bit instructions per second.

The Due:
1. It is pipelined and somewhat superscalar
2. It runs at 84Mhz
3. It is 32 bit.

All of this adds up to it being able to execute around 104 million 32 bit instructions per second.

Now, neither of them have floating point support. If you are actually using sqrt then slap yourself across the face as hard as you can. Done? Now do it again. For the love of God, use a look up table. If you use a Due you'll have plenty of space to store the table. Never, ever, ever, ever use floating point on a processor that doesn't have an FPU. There is almost always a better way to do it (like, say, in fixed point integer math). The due will help here as well because it natively crunches 32 bits per operation and so will deal much more quickly with large numbers. This is on top of how much faster it already is (104MIPS as opposed to 16 MIPS).

What exactly are you trying to do? Maybe I could suggest something.

EDIT: I was trying to be a bit humorous in my reply but it probably does sound rude... Don't take it personally.
55  Products / Arduino Due / Re: UART Arduino Due SAM3X8E on: August 05, 2013, 07:07:46 am
Heh, it always amazes me the # of people who come on the board to ask questions that obviously indicate that they aren't using the Arduino framework at all. Anyway, looking at the Arduino core library source would help here:

Here is the code that Arduino uses to initialize a UART:
  // Configure PMC
  pmc_enable_periph_clk( _dwId ) ;

  // Disable PDC channel

  // Reset and disable receiver and transmitter

  // Configure mode

  // Configure baudrate (asynchronous, no oversampling)
  _pUart->UART_BRGR = (SystemCoreClock / dwBaudRate) >> 4 ;

  // Configure interrupts
  _pUart->UART_IDR = 0xFFFFFFFF;

  // Enable UART interrupt in NVIC

  // Enable receiver and transmitter

You'll notice that you do need to enable the clock first.
56  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: August 03, 2013, 09:42:19 am
Yes, you can reconfigure the mailboxes any time you want. You can change what a mailbox does every loop if you want to.
57  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: July 19, 2013, 10:03:21 pm
It sort of seems that way. The default sending rate of the canbus examples is 1M baud so you really need to be closer to 1-10uS divs to see the actual signal itself but your larger div screen shows it trying to resend around 1.5ms between attempts. This makes it appear as if your Due is working perfectly fine. If things are still not working then perhaps the transceiver is not operating properly. You do have to enable the transceiver to make it work. You should probably try scoping the CANH and CANL lines to see if they're responding to the signal coming out of the Due.
58  Products / Arduino Due / Re: Arduino Due sampling speed on: July 19, 2013, 12:12:47 pm
What you're doing wrong is using the built-in analogRead function. It's slow as dirt. The hardware of the Due is capable of 1M samples per second but this has limits. You might get limited accuracy if the signal is quickly changing. You only get 1M samples per second if you only read one port. If you start changing which ADC you are reading you will get delays.

If you need very fast data acquisition then you should be setting up the DMA controller to take ADC readings and directly store them to RAM behind the processor's back and then read them once the sample buffer is full.

You can get more information here:
59  Products / Arduino Due / Re: complex headlight DRL on: July 19, 2013, 06:56:47 am
From the sounds of it you need to be able to individually address the LEDs to create your effects and some LEDs will be bi-color. You will probably be able to use a MEGA2560 for this. The thing is, you really don't have 64 outputs so you need a multiplexing scheme of some sort. You could do something like this:

But, presumably your LEDs will be pretty powerful so you might need drivers or transistors or something to power them.
60  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: July 10, 2013, 02:23:42 pm
Yeah, I eat my own dog food (common US expression... I use my own products). I'm using the library in an open source vehicle control unit:

So, I do know that it works well enough, at least with standard frames. I've been occupied with hardware design recently so neither this library nor GEVCU have gotten much love recently but all of it does work.

Pages: 1 2 3 [4] 5 6 ... 21