Skip to main content

Messages

This section allows you to view all Messages made by this member. Note that you can only see Messages made in areas you currently have access to.

Messages - liyin

333
Arduino / Re: AVR Programming & Arduino IDE
Sounds good. I've been looking at some AVR code and the jump to programming MCU's like the ATtiny2313 doesn't look too bad for small projects, obviously Arduino is the easiest way.

I also looked what the fuses were and they are not a complicated thing, they just can get in your way, but once you install the bootloader you don't touch them.

Which brings me to another point, using bootloaders without the Arduino's IDE. There's and interesting bootloader called Optiboot:

- Faster upload speed.
- More sketch space - the bootloader is a quarter of the Arduino bootloader size, giving 1.5K of extra flash space.

You need to put a file(s) in the Arduino IDE folder so I don't know if you can use it with AVRDude alone.

And there's BootloadHID and AVRUSBBoot. I would like to use BootloadHID with the ATtiny2313 so I'm still looking for an example on how to modify the sources so that the MCU can be programmed without using a jumper, just by accepting AVRDude's command to the bootloader during the first couple of seconds after reset (jumper-free firmware update).

The idea is to use a fast bootloader that allows pain-free updating of firmware (program) during the development phase.
334
USB Infrared Toy / Re: Parts for Breadboard & Schematic Questions
Finally got the parts and started with a simple IR circuit, (Win)LIRC, on a breadboard (voltage 1N4148-GND is 10V).

I'm using a GE Universal remote control (24944) programmed with Phillips TV code 0062.

EDIT: Moving up from WinLIRC (awkward & outdated) to IgorPlug serial port circuit. Found Girder v4 works better with the new IgorPlugXP plugin (for USB & COM circuits, Windows XP, 7.16.2005).
335
Arduino / AVR Programming & Arduino IDE
I found this enlightening post about programming AVRs & the Arduino IDE:

AVR vs Arduino - Which is right for me?

The biggest difference is that with Arduino, you are somewhat forced into doing things "The Arduino Way", vs being able do things "Your Way" - or in some case the way the rest of the non-arduino world does things.

A key difference in using Arduino is that the Arduino wiring library has abstracted away all I/O pin operations. It is both Arduino's greatest strength and yet it is also its greatest weakness.

Because of this abstraction library, the real guts of the AVR are hidden/masked from the user.

Arduino uses naked constants, i.e. numbers 0 - n. to refer to I/O "pins" rather than AVR ports & bits.

While this is nice for some things, the current Arduino wiring library code implementation is ...SLOW....... compared to the speed you can achieve if you directly write to the AVR port to set or clear bits using constants. (Arduino code could be made substantially faster, by re-writing the library code, but it will never be as fast as direct AVR port I/O which can set or clear bits in a single instruction)

NOTE: for many applications, speed is not really an issue. But for things like high speed bit banging or say an I/O intensive GLCD, it does matter.

Also because of the pin oriented mindset, the Arduino wiring library has no way of writing more than 1 bit/pin at a time because it has no notion of AVR "ports". It was based around the idea of individual I/O "pins".

And even looking at Arduino Pin #s, it is very difficult to tell if 2 pins are even on the same AVR port. In fact there is no way to know, other than by manually visually looking at mapping table or write code that uses a look up table.

So in Arduino if you want to set more than a single bit/pin, you have to call their DigitalWrite() function for each "pin".

There is nothing to prevent you from using the direct AVR port bit/pin capabilties available by using the defines supplied with the avr-gcc compiler, but once you do that you are beginning to leave the Arduino world behind.

In the big picture, when you use Arduino and their libraries, you can benefit from their "canned" environment and code base. It can offer a quick path to bringing up new code, but there is a price to pay for all these conveniences.

Some of the price is speed/performance. Another price is the lack of source level debugging. If you want to do source level debugging of your code, you can't do that with the Arduino IDE. Another big factor is that some of the AVR or avr-gcc capabilities are masked/hidden away and not supported. The Arduino IDE will not let you set set specific compiler or linker options.

So say you wanted to use sprintf() and format a floating point number. You need to use a special linker option to get the floating point support. You can't set that option with the Arduino IDE.

Another example, Arduino does not come with support for directly printing strings stored in AVR program memory.

So if you do something like:   [tt:]Serial.print("Hello Worldn");[/tt:]

While that string is stored in flash, there is also a copy stored in RAM. The arduino code only knows how to print strings stored in RAM.

Because of no source level debugging, printing strings out the serial port is a common way to debug Arduino code.

RAM is precious. And you can quickly overrun your ram with text strings when debugging on the smaller AVR chips if you aren't careful.

There are ways to avoid this duplication of string data in RAM, but Arduino does not support it. The Arduino team has focused on defining their interfaces to be generic and this type of stuff is very processor and compiler specific. IMHO, in this area and in a few others, the Arduino team have failed to address the realities of Harvard Architecture and RISC processors.

To remedy this you have to know how to write some "non arduino" avr-gcc specific code wrappers. And then you are slightly stepping outside of Arduino again.

A big plus to learning gcc and using real makefiles, is that this environment is very portable across OS platforms. The same toolset works on many processors from AVRs, to ARMs, to even PC application development.

As for GUIs, AVRstudio will provide a nice GUI but only for Windows. This is one advantage that the Arduino IDE has. Its GUI IDE is available on several OS platforms. There are other GUI based tools such as Eclipse that can be used across OS platforms.


As for GUIs, AVRstudio will provide a nice GUI but only for Windows. This is one advantage that the Arduino IDE has. Its GUI IDE is available on several OS platforms. There are other GUI based tools such as Eclipse that can be used across OS platforms.
337
USB Infrared Toy / Re: Parts for Breadboard & Schematic Questions
Reading about the Arduino it seems possible to use its IDE to program ATmega chips for use in your own projects without the need for the standard Arduino board (using a programmer, etc).

Is it feasible to use the Arduino IDE to program AVRs to replace PICs in a project like the IR Toy?
338
Bus Pirate Support / Re: BFP Logic Analyzer 0.7 (SUMP)
I saw a post where Ian mentions he couldn't get the BP working with the new versions of SUMP.

The BP entered Logic Analyzer mode some of the time, but will wait for some parts to make a formal test circuit and try again.
339
Bus Pirate Support / Re: Synthetos BP Case
The gap between layers 2 and 3 is less noticeable in the photos because the case is at an angle, while the camera is level with the table.

Depending how you screw/unscrew, you can sometimes see the gap between layers 3 and 4, the point is the thickness of the Plexiglass sheets doesn't account for the height of the USB connector. At the very least, the 3rd layer should be thicker.

No response from Synthetos to my emails, I'm using their Paypal account email address (synthetos@gmail.com).

EDIT: Got email from Synthetos, and hopefully will be able to fix it.   :)



342
USB Infrared Toy / Re: Buying parts
Mouser is also useful for finding substitute parts.

I think any 38KHz IR receiver module for remote control applications could be used. These are the IR receivers you'll find in several IR circuits on the net:

TSOP1738, TSOP2238, TSOP38238

TSOP17xx  => TSOP1838   => TSOP11xx   (xx KHz)
SFH506-xx => SFH5110-xx => SFH5111-xx (xx KHz)

You can check the datasheets of these parts for possible substitutes, sometimes differences among them are small.

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.01752448304session_write_close ( )...(null):0
20.01782579920ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.01782580696Database_MySQL->query( ).../DatabaseHandler.php:119
40.06292719456Database_MySQL->error( ).../Db-mysql.class.php:273