embedded

How to jump between programs in Stellaris

丶灬走出姿态 提交于 2019-12-17 19:01:51
问题 I am working on a boot loader for Stellaris LM3S1607 chip. I am using Keil MicroVision4 C compiler. The idea is to create 2 independent firmware that one will update another. In firmware1 i downloaded firmware2 file and write it to flash in address 0x3200. untill here it is working. i also verifed that the data is being written to flash correct. Now i have in flash two applications. one is my uip boot loader and the seoncd one is my main project. i want to know how can i jump from the first

Initializing SD card in SPI issues

*爱你&永不变心* 提交于 2019-12-17 18:29:09
问题 I've had a look at Stack Overflow question Initialization of a microSD card using an SPI interface and didn't see any answers that matched my issue (that is, things I haven't already tried). I have a similar issue where I'm trying to access a SD card through a microcontroller's SPI interface (specifically an HC908). I've tried following the flow charts in the Physical Layer Simplified Specification v2.00 and it seems to initialize correctly on Transcend 1 GB & 2 GB and an AE&C 1 GB card. But

Test Automation with Embedded Hardware

旧巷老猫 提交于 2019-12-17 17:29:16
问题 Has anyone had success automating testing directly on embedded hardware? Specifically, I am thinking of automating a battery of unit tests for hardware layer modules. We need to have greater confidence in our hardware layer code. A lot of our projects use interrupt driven timers, ADCs, serial io, serial SPI devices (flash memory) etc.. Is this even worth the effort? We typically target: Processor: 8 or 16 bit microcontrollers (some DSP stuff) Language: C (sometimes c++). 回答1: Sure. In the

Fastest way to scan for bit pattern in a stream of bits

落爺英雄遲暮 提交于 2019-12-17 17:28:54
问题 I need to scan for a 16 bit word in a bit stream. It is not guaranteed to be aligned on byte or word boundaries . What is the fastest way of achieving this? There are various brute force methods; using tables and/or shifts but are there any "bit twiddling shortcuts" that can cut down the number of calculations by giving yes/no/maybe contains the flag results for each byte or word as it arrives? C code, intrinsics, x86 machine code would all be interesting. 回答1: Using simple brute force is

how to convert double between host and network byte order?

徘徊边缘 提交于 2019-12-17 16:39:33
问题 Could somebody tell me how to convert double precision into network byte ordering. I tried uint32_t htonl(uint32_t hostlong); uint16_t htons(uint16_t hostshort); uint32_t ntohl(uint32_t netlong); uint16_t ntohs(uint16_t netshort); functions and they worked well but none of them does double (float) conversion because these types are different on every architecture. And through the XDR i found double-float precision format representations (http://en.wikipedia.org/wiki/Double_precision) but no

Floating point linear interpolation

99封情书 提交于 2019-12-17 15:36:25
问题 To do a linear interpolation between two variables a and b given a fraction f , I'm currently using this code: float lerp(float a, float b, float f) { return (a * (1.0 - f)) + (b * f); } I think there's probably a more efficient way of doing it. I'm using a microcontroller without an FPU, so floating point operations are done in software. They are reasonably fast, but it's still something like 100 cycles to add or multiply. Any suggestions? n.b. for the sake of clarity in the equation in the

High delay in RS232 communication on a PXA270

喜欢而已 提交于 2019-12-17 13:56:18
问题 I'm experiencing a long delay (1.5ms - 9.5ms) in a RS232 communication on a PXA270 RISC PC/104. I want to minimize the long delay but I'm a beginner with embedded devices and C++ so I think I'm missing something. The mentioned delay is at the time when the PXA board receives a packet from the external device via RS232 (115200 baud) until it sends an ACK custom packet back to the external device. I measured the delay on the PXA board with an oscilloscope, one channel at the Rx and the other on

Convert ASM to C (not reverse engineer)

对着背影说爱祢 提交于 2019-12-17 10:39:07
问题 I googled and I see a surprising amount of flippant responses basically laughing at the asker for asking such a question. Microchip provides some source code for free (I don't want to post it here in case that's a no-no. Basically, google AN937, click the first link and there's a link for "source code" and its a zipped file). Its in ASM and when I look at it I start to go cross-eyed. I'd like to convert it to something resembling a c type language so that I can follow along. Because lines

Is there a way to convert from UTF8 to iso-8859-1?

蓝咒 提交于 2019-12-17 09:58:06
问题 My software is getting some strings in UTF8 than I need to convert to ISO 8859 1. I know that UTF8 domain is bigger than iso 8859. But the data in UTF8 has been previously upconverted from ISO, so I should not miss anything. I would like to know if there is an easy / direct way to convert from UTF8 to iso-8859-1. Thanks 回答1: Here is a function you might find useful: utf8_to_latin9() . It converts to ISO-8859-15 (including EURO, which ISO-8859-1 does not have), but also works correctly for the

Fixed address variable in C

ぐ巨炮叔叔 提交于 2019-12-17 09:47:06
问题 For embedded applications, it is often necessary to access fixed memory locations for peripheral registers. The standard way I have found to do this is something like the following: // access register 'foo_reg', which is located at address 0x100 #define foo_reg *(int *)0x100 foo_reg = 1; // write to foo_reg int x = foo_reg; // read from foo_reg I understand how that works, but what I don't understand is how the space for foo_reg is allocated (i.e. what keeps the linker from putting another