We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I am using keil rtx5 for lpc4357 controller. Where I am trying to read data from adc and gpio pins. I created two threads. one is reading adc data and storing in a 64 bit structure. And other is reading gpio pins state. In adc I am using SPI0 to read and reading at a time 16 Byte data. While doing this my gpio reading data got affected. I saw the both gpio and ADC variables (Which is created by me) are assigned memory addresses are overlapping. How to solve this issue can anyone please help?
__NO_RETURN static void scanInputThread (void *arg) { osStatus_t result; while(1){ readInputs(CHANNEL0); } } __NO_RETURN static void adcReadThread (void *arg) { osStatus_t result; while(1){ adcReadSpi(); } } void adcReadSpi(void) { uint16_t i=0; CONV_STARTA; CONV_STARTB; CONV_ENDA; CONV_ENDB; delay_us(10); ptrSPI0->Control(ARM_SPI_CONTROL_SS, ARM_SPI_SS_ACTIVE); ptrSPI0->Receive (&(adcInput/*.adcData[i]*/),sizeof(adcInput/*.adcData[i]*/)); while (ptrSPI0->GetStatus().busy) ; ptrSPI0->Control(ARM_SPI_CONTROL_SS, ARM_SPI_SS_INACTIVE); } void readInputs(uint8_t channel) { switch(channel) { case CHANNEL0: INPUT_SEL_LATCH0; ahsDigitalInput.all[0] = (((uint8_t)GPIO_PortRead(MC_DATA_IN_PORT))); break; case CHANNEL1: INPUT_SEL_LATCH1; ahsDigitalInput.all[1] = (((uint8_t)GPIO_PortRead(MC_DATA_IN_PORT))); break; }