c,embedded,stm32,gnu-arm,coocox
I've found the reason: that's because stack size is actually fixed and it is located in heap (if I could call it heap). In file startup_stm32f10x*.c there is a section: /*----------Stack Configuration----------*/ #define STACK_SIZE 0x00000100 /*!< The Stack size suggest using even number */ And at then very next line:...
There is a MISRA rule that states the only pointer math allowed is the indexing operation. The pattern you have shown is a poorly executed work-around. It is ugly/weird/uncommon and probably based on a misunderstanding of the purpose of that rule. It may also violate another rule. A better way...
You can use the Makefile file provided with the kernel source to handle all the issues for you. From the kernel code root directory, simply run: make ARCH=arm CROSS_COMPILE=arm-none-eabi- imx_v6_v7_defconfig make ARCH=arm CROSS_COMPILE=arm-none-eabi- dtbs Just make sure to replace the CROSS_COMPILE value with the right prefix....
routes,embedded,protocols,ethernet,dhcp
I am not sure what you try to accomplish, but if your device already shows as an ethernet connection, can't you use the iptables to redirect traffic to your device? Else you can let your device act as a DNS server and handle incoming dns lookups and redirect them. Just...
embedded,cross-compiling,wind-river-workbench
I believe that the Diab compiler targets a free-standing environment, so would not produce a Windows executable. Moreover x86 is not a supported target processor in any case; see the product brief. The compiler is intended for use with VxWorks, though can be separately licensed. The toolchain includes an instruction-set...
Yes, you can do that. Many web services offer an API that lets you interact with the service via http. Twitter is one of these services; check out their REST api documentation: https://dev.twitter.com/rest/public Here's the endpoint to POST an update: https://dev.twitter.com/rest/reference/post/statuses/update I'd guess the trickiest thing for you will be...
With the code you posted, when only one input is set, the corresponding output is rapidly toggled on and off in your loop rather than remaining on, giving an output voltage that averages somewhere between that of a high output and that of a low one. This happens because although...
I will take the 2 minutes to answer you instead of lecturing you. Receive is done through interrupts. Very, very simply, the hardware sees the voltage change on the D+/D- and flags an interrupt based on the intialization functions. The interrupt calls HAL_PCD_IRQHandler, which calls USBD_LL_DataInStage in the usbd_conf.c file....
c,linux,linux-kernel,embedded,pwm
Pulse-width modulation is very, very hard to do in software. In theory, all you have to do is to find a timer in your CPU which has a good enough resolution, attach an IRQ handler and kick it off. If you look at the clocks, it feels insane that you...
c,optimization,debugging,embedded
The problem was solved. It was caused by a trivial bug. EEPROM's nHOLD and nCS signals were not initialized immediately after MCU's reset, but before the first use of the EEPROM. As a result they were 0's, so active. This means EEPROM was selected, but waiting on hold. Meantime other...
The general answer : Unfortunately no, currently there is no other way than using Java Card API to program a Java Card compatible card. The detailed answer: Some kind of cards have a mechanism named "Secure Box". As mentioned in the JCOP v2.4.2 r3 card Security target : The Secure...
You would have to look at the source for the version of libc to get a categorical answer. I did look at the source for one and found that, in that implementation, dpowers was a table of constants (powers of 10) used for output (doprnt). I suspect the others are...
c,linux-kernel,embedded,linux-device-driver,device-tree
OK, I got it figured out in the meantime and since nobody answered I'm going to provide my solution (maybe somebody else bumps into this issue): 81 if (clock_node != NULL) { 82 rc = of_parse_phandle_with_args(clock_node, "transition-clock", NULL, 83 0, &transition_clkspec); 84 of_node_put(transition_clkspec.np); 85 86 if (!rc) { 87 transition_clock...
c,arm,embedded,microcontroller,mbed
You should of course start by reading the mbed handbook. It is not a large API and you can get a good overview of it very quickly. The mbed platform is a C++ API, so you will need to use C++ compilation. There are several ways to achieve what you...
arm,embedded,embedded-linux,bus
A difference between ARM and the x86 is PIO. There are no special instruction on the ARM to access an I/O device. Everything is done through memory mapped I/O. A second difference is the ARM (and RISC in general) has a separate load/store unit(s) that are separate from normal logic....
The STM32 Flash memory interface locks its entire data bus during erase and write operations, such that any read operation is stalled during the access A Page erase can take up to 40ms on an STM32F1xx (it is a massive 800ms on an STM32F2xx!). Because the code is also running...
c,embedded,nios,quartus-ii,ucos
Clearly separate the control task from the I/O. They have different real-time requirements and performing both in the same task loop can be detrimental to control stability; although with a slow responding system such as a motor-vehicle, it may not be critical, but it still makes good design sense...
linux,embedded,low-latency,jack,cpuset
The topic you are looking for is called "CPU affinity". There are two main aspects to the CPU affinity: affinity of processes and affinity of the interrupts. To my (admittedly limited) knowledge: The processes are assigned to CPUs using the taskset command. (The affinity is inherited by the child processes.)...
c,arm,embedded,raspberry-pi,low-level
While bare metal is possible on the Pi, I would avoid it since Linux is getting so lightweight and handles a whole bunch of stuff for you. Here's a tutorial to get you started if you want to still learn bare metal stuff: http://www.valvers.com/open-software/raspberry-pi/step01-bare-metal-programming-in-cpt1/ With all that said, I would...
csv,gps,embedded,lookup,compass
There's a python module, geomag that's worth a look. magnetic_declination_degrees = geomag.declination(latitude, longitude) >>> import geomag >>> geomag.declination(-33, 151) 12.156567323514675 >>> not csv, but easy-peasy. Read the doc and you can adjust the model for date. Edit: If the embedded system runs gpsd, this gps3 client can fetch lat/lon automagically....
embedded,real-time,radio,rt,efm
Thanks for your help (sarcasm) :)) The answer is: 1. Check nIRQ pin of the radio module for the interrupt 2. When nIRQ pin goes down, read the interrupts from the radio module (don't check for CTS answer). 3. If you get Packet Receive Interrupt Pending flag - read the...
If the both those typedefs occur in the same header file, then the code doesn't make any sense. In that case, the first typedef is completely superfluous and the whole code could get replaced with typedef struct { ActiveObject ao; int state; } testActiveObject, *testActiveObjectPtr; Otherwise if the typedefs were...
In addition to setting the pin to use an alternate function, you must also set which alternate function to use. This is described in section 8.3.2 (pdf page 128) of the document you linked. These are the AFRL (for pins 0-7) and AFRH (for pins 8-15) registers on the port....
linux,git,deployment,embedded,rsync
Yes, this is a very broad question. This will not be a direct answer to your questions, but rather provide guidelines for your research. One means to prevent file system corruption is use an overlay file system (e.g., AUFS, UnionFS) where the root file system is mounted read-only and a...
My guess is that this code was intended to work correctly even if value is not a 1-byte (8-bit) type. The bitmask 0xFF makes sure that only the last byte of the value is kept.
You are converting a integer to a pointer, that means that you pass the actual value in display_address as the pointer location. This is 99% of the time a bad idea™ unless it's a round-robin cast of some description but then I suggest fixing the intermediate storage type instead. Instead...
All the values within Struct1 change except the values in Data and Data1. In which case the most likely cause is overrunning the bounds of Data1. I am working on C and on Keil. Keil provide compilers for several targets. It would be more useful to know the target,...
You could choose: avoiding any kind of dynamic memory implement your own malloc & free (or tune some existing malloc library for your need) implement your own garbage collector (I guess that simple mark&sweep could be suitable in your case). Look e.g. into OpenMirage as an example showing that a...
The registers for the MSP430 processors are defined in standard headers and can then just be accessed as variables, they are just memory locations after all. There is a gotcha with the TAR and TBR registers in that they can sometimes return an intermediate value if they are in the...
c,coding-style,arduino,embedded
You should create a Hardware Abstraction Layer (HAL). The code within the HAL encapsulates all the hardware specific differences. The higher level code that calls into the HAL should not be aware of any hardware specific differences because the HAL has abstracted those details into a more generic interface. Your...
c,embedded,iar,texas-instruments
I found. I post the answer whether other people need it. You can use : puts(const char *); putchar(int); getchar(void); sprintf(char *,const char *,...); vsprintf(char *,const char *,va_list); printf(const char *,...); vprintf(const char *,va_list); (source) After that, run the Debug mode. When you are in debug mode : View ->...
Controlling Structure Layout If you use the data types in <stdint.h> (e.g. int32_t, uint8_t) and define fields for every byte in your struct to keep types aligned with their sizes (e.g. 32-bit values should be 4-byte aligned, 16-bit values should be 2-byte aligned), then you should be okay and your...
I found a root cause! This is a HAL initialization function, generated by STM32CubeMX: void HAL_MspInit(void) { /* USER CODE BEGIN MspInit 0 */ /* USER CODE END MspInit 0 */ __HAL_RCC_AFIO_CLK_ENABLE(); HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); /* System interrupt init*/ /* SysTick_IRQn interrupt configuration */ HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); /**DISABLE: JTAG-DP Disabled and SW-DP...
embedded,static-libraries,true-type-fonts,freetype,keil
Create a new project "freetype". In the project settings change the "Output" to a static library: Add the freetype sources to the project, and build. Do not use your "amalgamated" source file - that will destroy the library granularity and lead to excessively large code. Add the resulting freetype.lib file...
The full details can't be stated from the information in the question, but: If the source code contains GPIOA_AHB as an identifier, it will be replaced by ((GPIOA_AHB_Type *)GPIOA_AHB_BASE) initially. What happens next depends on whether either GPIOA_AHB_Type or GPIOA_AHB_BASE is itself a macro. If there is a #define GPIOA_AHB_BASE...
If you know the endianless of your system, and it is static you have to select from char *current8bits = (char *)¤t32bits; or char *current8bits = (((char *)¤t32bits)+3); If you have to test it, and your system cannot give you such of info you can derive it at application startup...
c,embedded,8051,keil,gnu-toolchain
what the IDE/compiler will add to the code after selecting a particular "Microcontroller" in device list of keil or AVR Studio or PIC etc..? You are getting it wrong. Let's take a different approach: Think of a C program as a specification for your processor i.e description in human...
You clearly need a different toolchain. On your Debian-mipsel, your toolchain uses glibc while your target uses uClibc. So, maybe you would like to generate it by yourself using Buildroot: wget http://buildroot.uclibc.org/downloads/buildroot-2014.11.tar.gz tar zxf http://buildroot.uclibc.org/downloads/buildroot-2014.11.tar.gz cd buildroot-2014.11 A trick to preconfigure for mipsel, R1 without soft-float (my will, check yours):...
arduino,embedded,avr,rtos,atmega
If I understand correctly, the h8write program is supposed to run on your computer and transfer the compiled to the microcontroller. You are using a seeeduino, which is an Arduino compatible board, with Ubuntu. The standard way of programming on this environment is with the arduino software: install the arduino...
As you say, the standard says "The extent to which such suggestions are effective is implementation-defined." That gives the implementation free range to do anything from ignoring the suggestion to moving heaven and earth to implement it. An implementation which chooses to accept the register specifier as requiring the use...
No such portable function is possible. Your attempt is probably about as close as you can get, but the pointer subtraction has undefined behavior. More generally, p1 - p0, where p0 and p1 are pointers to distinct objects, has undefined behavior. Except that your code subtracts to int values that...
As it may happen that someone else gets bitten by the same bug, I post an answer to my own question. However, it was @Notlikethat 's comment which suggested the correct answer. This is a lesson of Thou shall not steal. I borrowed the gcc linker script which came with...
I guess you are using NMEA 0183 standard protocol for GPS. Messages are <CR> <LF> terminated and not NULL terminated. Then check if your is not using string function to do the work. I mean that the str_cpy has to look like below: str_cpy(char *tempbuff, char *aa_GPS_GPGGA_RxBuffer, uint8_t bufferlength) {...
I don't think it's necessary to go back through all the data. You need to go back up to two '\n' characters. To move the start pointer to the beginning of the previous line: If the previous char is '\n', then go back one character. (If the previous character is...
The USB specification defines six USB device states: Attached: the device is attached to the USB but is not powered by the USB. Powered: the device is attached to the USB and has been powered but has not yet received any reset request. Default: the device is attached to the...
embedded,hardware,microcontroller
I think they opened up the code for the propeller yes? and you can get an msp430 clone on opecores or an arm2 on opencores as well as the or1k and 2k, plus a myriad of other open source cores there and elsewhere (just google it). The lm32 is open,...
java,android,android-studio,embedded,zxing
In zxing-android-embedded/zxing-android/src/com/google/zxing/client/android/CaptureActivity.java there is defined private BeepManager beepManager; ... Look around to mute it....
looking for something to just allocate memory for the object which C will handle What about something like this? Give the struct an actual size (in this case by giving it a fixed-size array of byte-sized items), allocate that space on the heap, then treat that as a raw...
embedded,msp430,memory-mapping
P1OUT |= 0x80000000000; This does not work because you did not count bits correctly: P1OUT |= 0x10000000000000000; P1OUT is an 8-bit register, so the compiler would throw away all but the lowest eight bits. You would have to use a data type that is large enough (and the bit you...
Before compiling, you need to configure your target architecture, so that the compiler knows what type of device it is compiling code for. There are many different ARM architectures, with various code capabilities. You might want to check KEIL for an appropriate "Getting Started" guide. Here is one to start...
embedded,malloc,heap,keil,freertos
(Yes - FreeRTOS pvPortMalloc() returns void*.) If you have 60K of SRAM, and configTOTAL_HEAP_SIZE is large, then it is unlikely you are going to run out of heap after allocating 256 bytes unless you had hardly any heap remaining before hand. Many FreeRTOS demos will just keep creating objects until...
the typical sequence is to send a command to the device to put it into 'suspend' mode, then close the open file descriptor to that device.
embedded,linux-device-driver,embedded-linux,lcd
OLED is no different than LCD from the driver's perspective, so I'd recommend to start looking at TI provided Linux LCD drivers[1] (linux_src/drivers/video/fbdev/omap or omap2). Your MCU has DSS[2], so you don't need to do "pin level" drivers, only connect correct pins and configure registers. There's a big chance that...
embedded,microcontroller,electronics,8051,microprocessors
One possible solution - which is not an easy one - is to get the code of an open source emulator like this and modify the processor model and the assembler to know your extra instructions. Before you start you should study the processor architecture to know if your modifications...
assembly,embedded,microcontroller,firmware
For port mapped IO you need an extra driver for the interface. That would define completely how to address the external device. It can be as simple as a GPIO just driving an external register with a strobe, or SPI. All this is mostly software-defined or given by the interface....
You can do something like #define short int16_t #define int int32_t etc, and add it to the program. This is a really ugly solution, but it does what you need. These types have a specific size mandated by the standard. You'd need to include stdint.h for these types to be...
Step 1: Forget about energy meter and modbus for now. Most important thing is to get hardware working. RS485 is simply a serial port. Read manual on how to initialize serial port on your hardware, and send single byte to your PC and back. Then send hundreds of bytes to...
For Version 1, after you allocate 2 buffers (just use buffer and bufT), create 2 pointers to point to the current and previous rows, like this: uint16_t *currentRow = buffer; uint16_t *prevRow = bufT; Inside the row loop, write to currentRow instead of buffer: pixel16 pix(newPixel[0], newPixel[1], newPixel[2]); currentRow[X] =...
linux,networking,embedded,wireshark,ethernet
It appears to me like your memcpy() calls are all the wrong way around. void *memcpy(void *dest, const void *src, size_t n); Destination is the first, source the second argument....
embedded,windows-ce,windows-embedded-compact
It is solved. Stored dwReserved1 twice (each with parity bit, as it is written only once at sector initialization). Stored wReserved2 three times (as parity bit can't be applied here - flash filesystem writes to wReserved2 three times without erasing the sector, i.e. flipping single bits). If 2 copies are...
c++,class,dictionary,types,embedded
Well, you tell the compiler that mymap is a map that maps std::string keys to parameter_types values. However mymap["Circle"] = (int)1; is telling the compiler to put an int value under a std::string key, which it of course can't, since the value type is parameter_types. You must put your int...
char buf[15]; ... mi = minimum + 0x30; sprintf(buf, "%d", mi); putsUSART0("mimimum is:"); //putchUSART0(minimum ); putsUSART0(buf); Do similar for maximum also You are sending the value of ASCII character (and trying to convert it to character by adding 0x30 which is not the right way, you need to convert all...
c++,c,compiler-errors,makefile,embedded
I've found the solution. In the top of the .c file, was a check whether the constant PICO_DHCPD_SUPPORT was defined. This was not the case what caused my .c file not to compile and thus the implementation of the function could not be found. Adding this flag to the CC_FLAGS...
sure, why not, it is just spi. I think just out of convenience (of something with spi on it or trivial to bit bang) I use another microcontroller to program my avr (an msp430 or mbed which program easily over usb). avrs docs are pretty good on the protocol. you...
c,linux,kernel,embedded,kernel-module
I have managed to work around this problem. Using strace I've found out that the segfault is occurring somewhere when reading the BusyBox specifiv modules.dep.bb file. This file is used by BusyBox when it is compiled with the "Simplified modutils" option (CONFIG_MODPROBE_SMALL). By disabling the option, selecting the utils to...
@CL. Thank you for your guidance, that was really fruitful. I used the __no_init and logged the last function that it was in Before the Reset, however I couldn't conclude with this, so i created an ARRAY using __no_init and logged last 200 functions/places it had been before the RESET...
bluetooth,embedded,windows-ce,windows-embedded-compact,hci
It all got to do with SSP(Secured Simple Pairing), which decides the pairing authentication model. This is affected in WEC8(2013) through the changes under bthsettings. Under WEC8 they disable SSP(via function EnbaleSSP()) whenever a connection is initiated from external device and enable back SSP when conenction is initiated internally....
c,arduino,embedded,processing,atmega
Yes It will take processing time even if no serial monitor or other device is connected. A good practice is to a have a #define pre-processor directive in your code indicating whether you are debugging or not. e.g. #define DEBUG_PHASE #ifdef DEBUG_PHASE printf(...); #endif ...
android,opengl-es,embedded,shader
Uniform is a value that is set per draw call. For instance you may set a color for the whole shape you draw and for all the shader calls the uniform value will be the same. This is opposed to the attribute for instance which is per vertex or...
arm,embedded,cpu-registers,cmsis
If you look in your CMSIS header, you'll see all the structure definitions. Here's an example from my current project: typedef struct { __IO uint32_t DATA; /*!< Port A Data Register */ __IO uint32_t CR; /*!< Port A Output Control Register */ __IO uint32_t FR1; /*!< Port A Function Register...
embedded,microcontroller,uart,dma,stm32f4discovery
I do not use the HAL for performance reasons, as it is very clumsy and - imo also does not provide much abstraction to justify that. Handling the hardware directly is not much more complicated; even more as you still have to understand very well what goes on. And as...
The FTP protocol works with two distinct connections, the control connection and the data connection. Depending on the mode, the data connection may be initiated by either the server (active) or client (passive). The PASV command's (which indicates passive transfers) response contains the IP address and PORT the server is...
I think that using OpenVPN would be a easy way to tunnel to the device. You can cross compile it and set it up as a client on the embedded device. Then you install it on your Linux box and set it up as a server. Finally you install it...
c,operating-system,embedded,platform
The term platform varies with the context. Platform can be windows or linux for application software developers. It can be 32-bit,64-bit,Intel,AMD etc. for OS,Driver and firmware developers.(Based on CPU architecture) For Embedded systems platform is mostly used to refer processors architecture. There are many other terms you will encounter,those are...
c,embedded,microcontroller,avr,eeprom
TWI is a method for transferring data both ways from a master device to a slave device. In your case, your code runs on the master, and the EEPROM is the slave. The data moves between the devices at the same time. That is, a byte is transferred to the...
YOu cannot changge just few bytes in a sector without reading/writing the the whole 512 bytes. So you actually do need the RAM for buffer. However, there are ways to pre-alloc the filespace or update the FAT every some writes only. That will even conserve write cycles, but might result...
From the MSP430 Optimizing C/C++ Compiler v 4.4 User's Guide it appears you can achieve this is one of three ways: Using GCC __attribute__ syntax: #define TIMER_A0 20 volatile int tick = 0 ; __attribute__((interrupt(TIMER_A0))) void tick_isr() { tick++ ; } Using __interrupt + #pragma vector: #define TIMER_A0 20 volatile...
I seldom use the toolchain's debugger for my embedded work, except when I'm facing a very difficult problem or bringing up a board. Rather, I usually do "printf debugging" to one of the device's serial ports, and view the output in a serial terminal program (e.g. putty) on the host...
After lots and lots of comments and answers of not using dynamic memory, I still found a way which at the time being solved my problem. I changed this in my code typedef struct { task_t task; uint8_t next; uint8_t prev; uint8_t priority; } info_t; typedef struct { task_t task;...
ARM defines the functionality of the core only; chip manufacturers are free to add whatever peripheral features they desire; you cannot expect one manufacturer's feature to appear on another's - at least not in an identical implementation. Moreover a lot has changed in ARM cores in any case between the...
embedded,microchip,freertos,pic32
Configure the button to generate an interrupt. Write an interrupt handler as described on the documentation page for the FreeRTOS PIC32 port (see the "interrupt service routines" section on the following page: http://www.freertos.org/port_PIC32_MIPS_MK4.html ) Have the interrupt service routine do whatever you want to happen when the button is...
I tried to run your code, it seems to be working. For testbyte = 64, I got var1 = 2097152. May be int is not 32 bit for your platform, I can't think of any other reason....
Sometimes, it returns rc = 0 (no error) and read_ == 0 (zero number of bytes received). A bulk endpoint can send you packets with zero bytes of data, called zero packets. This is not an error condition. ...
What I ususally do is queue pointers or frame indices, rather than actual I/O data. An index into a frame array only needs to be one byte, and so is easily queued/manipulated. I put most of the indices onto a user-state pool queue at startup and the rest into a...
algorithm,embedded,lookup-tables,fixed-point
Note that 0.125radians * (2^31) approach is not suitable for angles > 1 radian. Probably, you wanted to normalize angle (0.125radians/2Pi) * (2^31) Anyway, you'll need to map 2^31 range to 2^9 - so just divide by 2^22. Example: Angle = 0.125 radians. 0.125 /(2*Pi) * 2^31 = 42 722...
embedded,embedded-linux,boot,gpio,u-boot
Recovery may depend on what your system has available to you, and how robust you need to be. Remember to always keep everything you can read-only and seperated it from stuff that is writeable. Keep writeable stuff in a different partition in your NAND or wherever. Your method described above...
I will post an answer because there are at least some interesting elements to your question that are close to appropriate for StackOverflow. detect bumps, so I need to distinguish the car bumping into something from being started or some other situations, such as jolts on the road. A collision...
c,linker,embedded,firmware,iar
This depends quite a bit on your tool-chain. Here's a possible high-view approach. Compile your library into an executable image, setting your linker to use a particular portion of your flash memory space. You'll probably need a fake/stub entry function for the linker to be happy. Once that is done,...
arm,embedded,microcontroller,atmel
The problem was not in the code but in Atmel's tools used to program the board. I had been using SAM-BA In-system Programmer to program the board but for some reason it failed to change the contents of the flash. Even setting a single manually in the memory view fails....
embedded,microcontroller,texas-instruments
As a satisfactory solution for the time being I started using Energia. I still had to search for the appropriate settings in order to run anything on my LaunchPad TM4C123G. So I decided to spare people some time, and decided to post a step by step walkthrough here. First, plug...
If you just want the contents of the file as a char-string, you can convert the file to C source code e.g. using a small Python program (or any other language, I just use Python for that as it is simple to do that in Python than in C or...
c,arm,embedded,cortex-m,codewarrior
The missing volatile is an error (albeit a common one) that itself should be a quality warning. The choice of where to instantiate a global is arbitrary, but from a cohesion point of view, it makes sense to keep data that relates to the interrupt with the interrupt. That said,...