embedded

Reading values of SPI data register of STM32 MCU

北战南征 提交于 2019-12-14 01:26:24
问题 There are quite a few similar questions, but none seem to have quite the same issue. I am connecting an STML4 MCU to a 6-axis sensor (LSM6DS3). I have successfully implemented everything in I2C, but would like the extra speed of SPI (and DMA, if I can get these first steps working...). So for a first step, I am trying to read the WHO_AM_I register ( 0x0F ) of the device, which should reply with 0x69 . Here is the code: uint8_t who = 0; // Sanity check/debugging aid should get 0x5D who = 0x43

GDB scripting to MOCK

六眼飞鱼酱① 提交于 2019-12-14 01:24:17
问题 I am trying to mock a function (for unit testing parent function) using GDB. One way to do it would be to set a break point in function you intend to mock and use GDB return command. However I am unable to do the same when GDB call command is used. (gdb) b secret_check Breakpoint 1 at 0x80483ba: file ut_gdb.c, line 6. (gdb) start Temporary breakpoint 2 at 0x804843c: file ut_gdb.c, line 34. Starting program: ut.bin Temporary breakpoint 2, main () at ut_gdb.c:34 34 int res = 0; (gdb) bt #0 main

volatile keyword usage in ISR function in micro-controller programing

北慕城南 提交于 2019-12-14 00:04:25
问题 As a general concept Global variable ("value") used in ISR function should be declared as volatile to avoid compiler optimization. but my doubt is a global variable is used in sub-function "ISR-SUB" which is invoked in ISR, whether the global variable used sub-function which is invoked in ISR also needs to be declared as volatile ? unsigned int STATUS; // -----> needs to be declared as volatile ? void ISR-SUB() { STATUS = 1; -->accessed in sub function invoked in ISR which will be optimized

How to give an estimation of the energy consumed by a program on an ARM platform? [closed]

风格不统一 提交于 2019-12-13 22:28:21
问题 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 3 years ago . Is there a way to estimate the energy consumed by a program on an ARM CPU? In embedded systems, energy consumption is one of the most important parameters and I was wondering whether it is possible for a programmer to know approximately how much energy is needed to run the program

Nordic SDK printing to serial

此生再无相见时 提交于 2019-12-13 21:17:02
问题 I have an Arduino device that runs on the Nordic SDK (it's a Red Bear Lab BLE nano). I want to be able to do a serial print into GTKTerm to be able to debug what is going on in my code. To do this I have the following code: /* * Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. * * The information contained herein is confidential property of Nordic Semiconductor. The use, * copying, transfer or disclosure of such information is prohibited except by express written * agreement with

Secure mode can access secure / non secure memory how?

烂漫一生 提交于 2019-12-13 20:12:56
问题 As per CortexA prog Guide TrustZone hardware also effectively provides two virtual MMUs, one for each virtual processor. This enables each world to have a local set of translation tables, with the Secure world mappings hidden and protected from the Normal world. The page table descriptions include a NS bit, which is used to determine whether accesses are made to the secure or non-secure physical address space. Although the page table entry bit is still present, the Normal virtual processor

Undefined reference to main when using Real-Time For the Masses

不羁的心 提交于 2019-12-13 18:13:51
问题 I'm trying to write a multi-threaded bare-metal application for the STM32F4Discovery using the Real-Time For the Masses (RTFM) crate. I've frankensteined together a minimal application from an example for the STM32F3Discovery board and this example: #![deny(unsafe_code)] #![no_main] #![no_std] extern crate cortex_m; extern crate cortex_m_rtfm as rtfm; extern crate cortex_m_semihosting; extern crate panic_semihosting; extern crate stm32f4; use stm32f4::stm32f407; use rtfm::app; app! { device:

No source code lines were found at current PC 0x0

旧巷老猫 提交于 2019-12-13 18:05:41
问题 I am having issues using MPLAB X IDE. I have a main.c with a main section. When I try to debug, I can't. It says no source code lines were found. I have compiled the software and debugged in MPLAB IDE without issue. I feel as though there is a setting in MPLAB X or something else basic that I am missing. Though I am not sure it is useful, for the sake of information, I am using a PICKit2 for debugging, MPLAB X IDE v1.51, PIC16F876 uC. main code in main.c: int main(int argc, char** argv) {

How to set ARM user app start address when using USB bootloader?

风流意气都作罢 提交于 2019-12-13 16:24:22
问题 Just picked up one of these ARM Cortex-M3 LPC1768 mini boards from eBay. It's basically a breakout board. However, based on what little documentation came with it, I've determined that it has a USB bootloader similar to that described by NXP's LPC1700 secondary USB bootloader (AN10866) app note. Both docs (the app note and board docs) indicate that user programs are to be built such that their starting address is 0x2000 . Because the USB bootloader is already at 0x0 and takes up 8K . Both

Enable pullup GPIO

天涯浪子 提交于 2019-12-13 15:01:23
问题 im working with a AT91SAM9G25 board which has 4 PIO controller managing up to 32 programmable I/O lines. Each pin is configurable as either a general-purpose I/O line only or as an I/O line multiplexed up to two peripheral I/Os. So, for example, according with the documentation (SAM9G25, page 14), signal PC0 can be multiplexed such a general purpose I/O line or as the ISI_D0 line of the VIDEO_ATMEL_ISI (ISI of Image Sensor Interface). ╔════════════╦════════════╦════════════╦════════════╦═════