embedded

NVIC_SystemReset() stuck in while loop (STM32F302VB)

十年热恋 提交于 2020-01-06 19:24:35
问题 I'm currently developing on a STM32F302VB and I need to perform a software reset. On all my previous projects (with STM32F427 and STM32F030C8), I've always used the NVIC_SystemReset() function successfully. But for some reason it won't work with this chip. The implementation is in CMSIS core_cm4.h and is as follows: __STATIC_INLINE void NVIC_SystemReset(void) { __DSB(); /* Ensure all outstanding memory accesses included buffered write are completed before reset */ SCB->AIRCR = ((0x5FA << SCB

Non blocking read with fixed data in input

不问归期 提交于 2020-01-06 18:45:32
问题 I want use serial port to communicate with another device txdev, the problem is that txdev is sending data asynchronously and i don't want the read function to block, the good thing is that txdev is sending data with fixed size but i don't know how to use this trick. what i'am doing is the following : fd = open(DEVICE_NAME, O_RDWR | O_NOCTTY); bzero(&termios_p, sizeof(termios_p)); termios_p.c_cflag = CS8|CSTOPB|CLOCAL|CREAD; termios_p.c_iflag = IGNPAR; termios_p.c_oflag = 0; termios_p.c_lflag

S3c2440(ARM9) spi_read_write Flash Memory

时光毁灭记忆、已成空白 提交于 2020-01-06 13:04:50
问题 I am working on SPI communication.Trying to communicate SST25VF032B(32 MB microchip SPI Flash). When I am reading the Manufacturer Id it shows MF_ID =>4A25BF but originally it is MF_ID =>BF254A. I am getting it simply reverse, means first bite in 3rd and 3rd byte in first. What could be the possible reason for that? My SPI Init function is here: //Enable clock control register CLKCON 18 Bit enables SPI CLKCON |= (0x01 << 18);//0x40000; printk("s3c2440_clkcon=%08ld\n",CLKCON); //Enable GPG2

S3c2440(ARM9) spi_read_write Flash Memory

守給你的承諾、 提交于 2020-01-06 13:04:11
问题 I am working on SPI communication.Trying to communicate SST25VF032B(32 MB microchip SPI Flash). When I am reading the Manufacturer Id it shows MF_ID =>4A25BF but originally it is MF_ID =>BF254A. I am getting it simply reverse, means first bite in 3rd and 3rd byte in first. What could be the possible reason for that? My SPI Init function is here: //Enable clock control register CLKCON 18 Bit enables SPI CLKCON |= (0x01 << 18);//0x40000; printk("s3c2440_clkcon=%08ld\n",CLKCON); //Enable GPG2

Use Linux to share continous RAM between processors

若如初见. 提交于 2020-01-06 06:07:56
问题 I am working with the Zynq 7 of Xilinx. On the Zynq there is a FPGA, an ARM processor and 512 MiB of DDR RAM. When the board is powered on, the ARM processor starts Ubuntu, which initializes the DDR RAM and claims it as its own. On the FPGA, I am developping another processor and I want to give it a piece of DDR memory. Since I am still developing, I would like to somehow allocate a piece of 64 MiB of continous DDR RAM from linux userspace (the device has a MMU). I would then get the start

how to single-step code on-target with no jtag, breakpoints, simulator, emulator

左心房为你撑大大i 提交于 2020-01-06 06:01:13
问题 Let's say you have a pointer to function whose source you do not have and which is "untrusted" because it might read/write to disallowed memory region. Before it executes each assembly instruction, you want to verify that it doesn't access disallowed memory regions. The OS is (almost) bare-metal i.e. a custom RTOS (so no Linux or QNX). This is for a functionality that needs to be enabled not only during development but during normal runtime. Ideally, it'd run something like this: void (*fptr)

Embedded Tcl: Does Tcl autocomplete commands?

限于喜欢 提交于 2020-01-06 04:08:04
问题 We have a Tcl built in our C/C++ application, I found the place in our code where Tcl_EvalObjv is called if the command was not found. I have to admit that the code is pretty old and not many of our developers know what happens in this module. It looks like this: // ... there is some checking if command is registered etc., it fails and the code goes here: std::vector<Tcl_Obj*> tclArgs = { NULL }; for (int i = 1; i < objc; ++i) tclArgs.push_back(objv[i]); tclArgs.shrink_to_fit(); // ...

Tools for c++ multiplatform projects

霸气de小男生 提交于 2020-01-06 02:58:18
问题 I am working with a c++ multi-platform project using visual studio 2010, there is a shared portion of code among all platforms, but there is a big portion that is dedicated to each one, I separate them using #if def, but it turns out that code maintenance become very though and the code is cluttered, in addition to problems like code does not compile with some defines turned on or off. Is there any plugin or tool for visual studio that helps in developing multi-platform projects, for example

How to find offset in a sine lookup table (LUT) using fixed point arithmetic

独自空忆成欢 提交于 2020-01-05 10:20:07
问题 I am generating a LUT dividing 0-2PI into 512 fragments and then finding sine of these values and storing them as Q1.31 values. Example: LUT[0] = 0 LUT[1] = sin((1/512) * 2*PI) * (2^31) .. .. LUT[511] = sin((511/512) * 2*PI) * (2^31) My inputs are also values in the Q1.31 format. My question is how do I go about using the LUT i.e. what is the algorithm to find the offset values in the table when I get a random value as an input to figure out the sine value Example: int sample_input = 0.125 *

Alternative of modulo operator in embedded C? [closed]

≡放荡痞女 提交于 2020-01-04 14:31:42
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 9 months ago . is there any alternative of % operator in embedded c ? there are some other ways of doing it such as using while loops in c++. but is it true that modulo operators slow down microcontroller systems ? 回答1: Whether or not the modulo operator slows down embedded systems depends a