embedded

How to deal with a wrapping counter in embedded C

自闭症网瘾萝莉.ら 提交于 2020-02-26 08:05:05
问题 I need to deal with a counter that gives me ticks for my application. The counter is 32bits so what i need to know is how to deal with it when it wraps. for example: I have a function that returns a (timestamp + shifttime) and i have another function that will return 1 or 0 depending whether or not the time has elapsed, but there could a possibility that that my counter will wrap how do I deal with this ?. Thanks Thanks a lot for all the responses guys. I will give more detail in this edit. I

How to find C++ language constructs allocating dynamic memory?

让人想犯罪 __ 提交于 2020-02-24 10:23:27
问题 I work on an embedded system firmware code-basis which currently uses dynamic memory allocation. Now, all dynamic memory allocation shall be removed for reliability reasons. As a first step, I removed the _sbrk syscall implementation, such that all dynamic allocations fail to link. Since I compile with -ffunction-sections -fdata-sections and link with -Wl,--gc-sections I expect the link step to complete as long as no dynamic memory allocation occurs. (This worked for me in past C projects,

problems while importing freeRTOS to AT32UC3A0512

梦想的初衷 提交于 2020-02-06 04:22:13
问题 i am attempting to integrate freeRTOS to my application that run on AT32UC3A0512. I downloaded a freeRTOS project example for EVK1100 (it Supports the AT32UC3A) and try to include the kernel source file so my application hierarchy looks like : src |ASF |APP_FOLDER |freertos |freertos-7.0.0 this hierarchy is different than the the hierarchy provided in the freeRTOS project example which looks like src |ASF |thirdparty |freertos |freertos-7.0.0 /********** freertos-7.0.0 is under ASF***********

Generate sine signal in C without using the standard function

心已入冬 提交于 2020-01-30 19:37:06
问题 I want to generate a sine signal in C without using the standard function sin() in order to trigger sine shaped changes in the brightness of a LED. My basic idea was to use a lookup table with 40 points and interpolation. Here's my first approach: const int sine_table[40] = {0, 5125, 10125, 14876, 19260, 23170, 26509, 29196, 31163, 32364, 32767, 32364, 31163, 29196, 26509, 23170, 19260, 14876, 10125, 5125, 0, -5126, -10126,-14877, -19261, -23171, -26510, -29197, -31164, -32365, -32768, -32365

Generate sine signal in C without using the standard function

大城市里の小女人 提交于 2020-01-30 19:37:05
问题 I want to generate a sine signal in C without using the standard function sin() in order to trigger sine shaped changes in the brightness of a LED. My basic idea was to use a lookup table with 40 points and interpolation. Here's my first approach: const int sine_table[40] = {0, 5125, 10125, 14876, 19260, 23170, 26509, 29196, 31163, 32364, 32767, 32364, 31163, 29196, 26509, 23170, 19260, 14876, 10125, 5125, 0, -5126, -10126,-14877, -19261, -23171, -26510, -29197, -31164, -32365, -32768, -32365

How do I debug unexpected resets in a STM32 device?

戏子无情 提交于 2020-01-30 14:40:30
问题 I'm doing some development in C with a STM32F107 chip and, at some point, the device began to reset when I call a specific function. I don't have a debugger and my debugging is just plain text over a serial port. I've used some other microcontrollers in which I was able to access a register to see the cause of the reset, but I can't seem to find an equivalent for this device. I'm aware of the hardware exceptions of the Cortex-M3, but I don't know if one of them is being triggered since I can

How do I debug unexpected resets in a STM32 device?

时光毁灭记忆、已成空白 提交于 2020-01-30 14:40:08
问题 I'm doing some development in C with a STM32F107 chip and, at some point, the device began to reset when I call a specific function. I don't have a debugger and my debugging is just plain text over a serial port. I've used some other microcontrollers in which I was able to access a register to see the cause of the reset, but I can't seem to find an equivalent for this device. I'm aware of the hardware exceptions of the Cortex-M3, but I don't know if one of them is being triggered since I can

Experiences with (free) embedded TCP / IP stacks? [closed]

我的梦境 提交于 2020-01-30 13:56:50
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Does anyone have especially good (or bad) experiences with any of the following embedded TCP / IP stacks? uIP lwIP Bentham's TCP/IP

Experiences with (free) embedded TCP / IP stacks? [closed]

流过昼夜 提交于 2020-01-30 13:56:08
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Does anyone have especially good (or bad) experiences with any of the following embedded TCP / IP stacks? uIP lwIP Bentham's TCP/IP

sprintf re-entry into 64bit operation in 32 bit MCU with interrupts

拈花ヽ惹草 提交于 2020-01-26 04:43:06
问题 In reference to SO question: 52164135 The setup : I have a function which converts many double values into a predefined string. The input is a array of struct from which we concatenate two double values into a string. A double is of size 8 bytes or 64 bits and my MCU of operation is STM32, a 32 bit ARM micro-controller. An interrupt is also running parallelly. The data should look like: [[12.11111111,12.11111111],[12.22222222,12.22222222],...] But I get (very rarely): [[12.11111111,12