embedded

Binary data over serial terminal

情到浓时终转凉″ 提交于 2019-11-29 00:24:31
My only way of communication with my embedded device is a serial port. By default, embedded Linux uses this port as a terminal. How do I disable this terminal and use the serial link to transfer binary data? I heard of commands like rx and tx but i cannot find them. I think I can just read() from and write() stuff to /dev/tty but I want to make sure no error messages or whatever mess with my data stream. You can use an application like xmodem to transfer file over any terminal. Is the serial port you speak off a terminal, or is it also the kernel console. If you're kernel is not noisy, then

Simple Debounce Routine

孤者浪人 提交于 2019-11-28 23:18:53
问题 Do you have a simple debounce routine handy to deal with a single switch input? This is a simple bare metal system without any OS. I would like to avoid a looping construct with a specific count, as the processor speed might fluctuate. 回答1: I think you could learn a lot about this here: http://www.ganssle.com/debouncing.pdf Your best bet is always to do this in hardware if possible, but there are some thoughts on software in there as well. Simple example code from TFA: #define CHECK_MSEC 5 //

What is the advantage of using memset() in C

六月ゝ 毕业季﹏ 提交于 2019-11-28 23:16:53
问题 I was curious as to whether or not there was any advantage in regards to efficiency to utilizing memset() in a situation similar to the one below. Given the following buffer declarations... struct More_Buffer_Info { unsigned char a[10]; unsigned char b[10]; unsigned char c[10]; }; struct My_Buffer_Type { struct More_Buffer_Info buffer_info[100]; }; struct My_Buffer_Type my_buffer[5]; unsigned char *p; p = (unsigned char *)my_buffer; Besides having less lines of code, is there an advantage to

itte in arm assembly

放肆的年华 提交于 2019-11-28 21:23:37
What does the following line do in arm assembly: 000031e6 2916 cmp r1, #22 000031e8 bf1a itte ne I get the first line (comparing r1 to 22) but what about the second line (I've never seen the itte command before and googling returned nothing) It is the ARM's IF-THEN-ELSE instruction, which was introduced in the Thumb-2 instruction set. (Based on your specific example above, it would have been helpful if you had shown the next 3 instructions that followed the ITTE instruction, you'll understand why when you're done reading this answer.) This instruction is used for handling small sequences of

Lisp on embedded platforms [closed]

家住魔仙堡 提交于 2019-11-28 21:12:30
问题 Are there any open source Lisp compilers suitable for real-time embedded applications? I.e. with incremental garbage collection, customisable memory handling, small footprint, etc. Edit: To clarify, by "compiler" I meant native code, not bytecode interpreter (though the suggested interpreting implementations for microcontrollers are interesting for being a lot smaller than what I thought possible!). 回答1: Take a look at Picobit and the code, which is a Scheme for microcontrollers. There is

D-Bus tutorial in C to communicate with wpa_supplicant

我们两清 提交于 2019-11-28 20:37:44
I'm trying to write some code to communicate with wpa_supplicant using DBUS. As I'm working in an embedded system (ARM), I'd like to avoid the use of Python or the GLib. I'm wondering if I'm stupid because I really have the feeling that there is no nice and clear documentation about D-Bus. Even with the official one, I either find the documentation too high level, or the examples shown are using Glib! Documentation I've looked at: http://www.freedesktop.org/wiki/Software/dbus I found a nice article about using D-Bus in C: http://www.matthew.ath.cx/articles/dbus However, this article is pretty

How can I visualise the memory (SRAM) usage of an AVR program?

江枫思渺然 提交于 2019-11-28 20:30:49
I have encountered a problem in a C program running on an AVR microcontroller (ATMega328P). I believe it is due to a stack/heap collision but I'd like to be able to confirm this. Is there any way I can visualise SRAM usage by the stack and the heap? Note: the program is compiled with avr-gcc and uses avr-libc. Update: The actual problem I am having is that the malloc implementation is failing (returning NULL ). All malloc ing happens on startup and all free ing happens at the end of the application (which in practice is never since the main part of the application is in an infinite loop). So I

Checking if a longitude/latitude coordinate resides inside a complex polygon in an embedded device?

时间秒杀一切 提交于 2019-11-28 20:29:15
问题 I need the user to be able to draw a complex polygon on a map and then have the application check if a given longitude/latitude resides within that polygon. I was only able to find algorithms that were using a simple x/y cartesian coordinate system that doesn't compensate for the curvature of the earth. The user draws the polygon on a PC, where the points are transferred over radio to a embedded device, which then needs to check if the given polygon resides within it's current position (taken

LZW compression/decompression under low memory conditions

ⅰ亾dé卋堺 提交于 2019-11-28 19:52:53
Can anybody give pointers how I can implement lzw compression/decompression in low memory conditions (< 2k). is that possible? The zlib library that everyone uses is bloated among other problems (for embedded). I am pretty sure it wont work for your case. I had a little more memory maybe 16K and couldnt get it to fit. It allocates and zeros large chunks of memory and keeps copies of stuff, etc. The algorithm can maybe do it but finding existing code is the challenge. I went with http://lzfx.googlecode.com The decompression loop is tiny, it is the older lz type compression that relies on the

The prefetch instruction

99封情书 提交于 2019-11-28 19:26:05
It appears the general logic for prefetch usage is that prefetch can be added, provided the code is busy in processing until the prefetch instruction completes its operation. But, it seems that if too much of prefetch instructions are used, then it would impact the performance of the system. I find that we need to first have the working code without prefetch instruction. Later we need to various combination of prefetch instruction in various locations of code and do analysis to determine the code locations that could actually improve because of prefetch. Is there any better way to determine