How to transfer the data between the GPIO port to internal memory SRAM in LPC4370 without using the DMA technique such that is there is any single Embedded C instruction to transfer the any one of the GPIO port data into the internal SRAM specified addres

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to transfer the data between the GPIO port to internal memory SRAM in LPC4370 without using the DMA technique such that is there is any single Embedded C instruction to transfer the any one of the GPIO port data into the internal SRAM specified addres

2,211 Views
sujayp
Contributor II

How to transfer the data between the GPIO port to internal memory SRAM in LPC4370 without using the DMA technique such that is there is any single Embedded C instruction to transfer the any one of the GPIO port data into the internal SRAM specified address in LPC4370 ?

 

will you please suggest me, how to write the same

 

0 Kudos
4 Replies

1,430 Views
jeremyzhou
NXP Employee
NXP Employee

Hi sujay p,

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.

To achieve the goal, firstly, you should define a array which locate at the specific address in the RAM, then the array can be wrote by the value of the GPIO port via C language.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,430 Views
sujayp
Contributor II

Hi,

Is the code something which is similar to the mentioned below such that in order to save the GPIO data  at the internal memory location :-

int main()

{

/* initial instruction is important to use the shadow area */

uint32_t *var  __attribute__((at(0x10080000)));

LPC_CREG->M4MEMMAP = 0x1C000000;

LPC_CREG->M0SUBMEMMAP = 0x1C000000;

LPC_CCU1->CLK_M4_GPIO_CFG = CCU_CLK_CFG_AUTO | CCU_CLK_CFG_RUN ;

while (!(LPC_CCU1->CLK_M4_GPIO_STAT & CCU_CLK_STAT_RUN));           

/*  CLK_M4_GPIO_STAT can access as a read value and cant be written and the value  which  would depends on the CLK_M4_GPIO_CFG Configuration  Register  */

/* To configure The GPIO port as the write pin or output Pin or output port in word format or Byte format  or Bit format */

/*  To format the GPIO single pin in the  output bit  */

LPC_SCU->SFSPD_12 = 4;

/* The 4 value is the mode Value for the function 4 such that GPIO PORT GPIO6[26] */

LPC_GPIO_PORT->DIR[6] |= 1 << 6;

/* The value is the Directory value set the GPIO6[26] as the output bit Pin */

LPC_GPIO_PORT->SET[6] = 1 << 6 ;

while(1)

{

if(LPC_GPIO_PORT->PIN[0] && LPC_GPIO_PORT->PIN[1] == 0xFFFFFFFF)

{

*var = LPC_GPIO_PORT->PIN[6];  //  Read the Port Number 6 and save it in the memory location 0x10080000

var++;                                             // Increment the Address

}

}

}

Regards

Sujay

 

 

0 Kudos

1,430 Views
sujayp
Contributor II

Hi,

 

Is the code something which is similar to the mentioned below such that in order to save the GPIO data  at the internal memory location :-

Actually in the previous code set GPIO6 [26] is set as a write pin ; I think it wont work

int main()

{

/* initial instruction is important to use the shadow area */

uint32_t *var  __attribute__((at(0x10080000)));

LPC_CREG->M4MEMMAP = 0x1C000000;

LPC_CREG->M0SUBMEMMAP = 0x1C000000;

LPC_CCU1->CLK_M4_GPIO_CFG = CCU_CLK_CFG_AUTO | CCU_CLK_CFG_RUN ;

while (!(LPC_CCU1->CLK_M4_GPIO_STAT & CCU_CLK_STAT_RUN));           

/*  CLK_M4_GPIO_STAT can access as a read value and cant be written and the value  which  would depends on the CLK_M4_GPIO_CFG Configuration  Register  */

*var = LPC_GPIO_PORT->PIN[6];  //  Read the Port Number 6 and save it in the memory location 0x10080000

var++;                       // increment the Address

}

 

Regards

Sujay

 

 

0 Kudos

1,430 Views
vxs187
Contributor III

Were you able to read pins? I am just trying to give a DC supply but am not able to get any proper output, it always gives me 0, meaning the input is always low, even when I am giving a DC of 3.3V. Do I have to supply a greater voltage? I am totally left clueless. I am using GPIO1_0. 

0 Kudos