3 months ago.

¿¿¿ how to calculate rms value of an array using mbed nxp lpc1768 ????

Hello everyone, i have mbed nxp lpc1768 board, am using Keil uVision as IDE. I'm trying to do a simple program that calculate the rms value of an array. am using Statistics Math Function from the DSP pack ( arm_cortexM3I_math.lib ) :

- void arm_rms_f32 (float32_t *pSrc, uint32_t blockSize, float32_t *pResult) (

i have no error problem when i compile the code , but when i start debugging i see error message at the Command window : "Cannot access Memory (@ 0x10008000, Write, Acc Size: 4 Byte)" ,/media/uploads/JaafarBelouaret/captura.png /media/uploads/JaafarBelouaret/captura.png

the code is :

  1. include "mbed.h"
  2. include "arm_math.h"

q31_t data [5]= {1,2,3,4,5}; q31_t *d = data; q31_t *pRes ;

int main (void) {

arm_rms_q31(d, 5, pRes);


Could anyone help me cuz i couldnt resolve this problem/errorany ???


Comment on this question

1 Answer

3 months ago.

When posting code please use

your code

This will keep the formatting correctly.

The problem is that you are creating a pointer pRes but never setting it to point to a memory location. This means that it is pointing to a random location in memory (normally it will end up being 0 but it could be anywhere). In this case it's pointing to a read only address and so when the RMS function tries to write the result to that memory address you get a crash.

Remember pointers can't store values, if you need to store a value you must also create a variable to store it in.


#include "mbed.h"
#include "arm_math.h"

q31_t data [5]= {1,2,3,4,5};
q31_t *d = data;
q31_t pRes; // variable to hold the result
q31_t *pResPointer = &pRes; // pointer to that variable.

int main (void) {
  arm_rms_q31(d, 5, pResPointer);
 // result is now in pRes

You could simplify this a little, the two pointer variables aren't really needed:

#include "mbed.h"
#include "arm_math.h"

q31_t data [5]= {1,2,3,4,5};
q31_t pRes;

int main (void) {
  arm_rms_q31(data, 5, &pRes);

Hello Andy , thaanks for ur help .that was the issue :)

posted by Jaafar Belouaret 01 May 2018

To post an answer, please log in.