【ARM】s3c2410 gpio debugging

Publisher:未来画家Latest update time:2021-07-12 Source: eefocusKeywords:ARM  s3c2410 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Debugging preparation


Compilation tool: MDK470a


Development board: s3c2410


Debugging method: Get the hex file after compiling with mdk, convert it into bin file with hex2bin tool, download it via USB, and observe it on DNW



#define GPFCON (*(volatile unsigned long*)0x56000050)


#define GPFDAT (*(volatile unsigned long*)0x56000054)


//===PORT F GROUP


//Port: GPF7 GPF6 GPF5 GPF4 GPF3 GPF2 GPF1 GPF0


//Signal: LED_1 LED_2 LED_3 LED_4 FS2_INT GPLD_INT1 KEY_INT BUT_INT1


//Set properties: output output output output EINT3 EINT2 EINT1 EINT0


//Binary value: 01 01 01 01 00 00 00 00


int i,nout;  


int Main()  


{  


      GPFCON = 0x00005500;  


//GPFDAT = 0x00000050;    


           nout=0x000000F0;  


while(1)  


           {  


               GPFDAT=nout & 0x00000070;    


for(i=0; i<1000000; i++);  


               GPFDAT=nout & 0x00000030;    


for(i=0; i<1000000; i++);  


               GPFDAT=nout & 0x00000010;  


for(i=0; i<1000000; i++);  


               GPFDAT=nout & 0x00000000;    


for(i=0; i<1000000; i++);  


//led();


           }      


//return(0);


}  


Phenomenon: LED1~4 turn on and off in a cycle with equal time intervals



#define GPFCON (*(volatile unsigned long*)0x56000050)


#define GPFDAT (*(volatile unsigned long*)0x56000054)




int i,nout;


void led(void)


{


   GPFDAT=nout & 0x00000070;  


for(i=0; i<1000000; i++);


   GPFDAT=nout & 0x00000030;  


for(i=0; i<1000000; i++);


   GPFDAT=nout & 0x00000010;  


for(i=0; i<1000000; i++);


   GPFDAT=nout & 0x00000000;  


}


int Main()


{


      GPFCON = 0x00005500;


//GPFDAT = 0x00000050;


           nout=0x000000F0;


while(1)


           {


               GPFDAT=nout & 0x00000070; //μãááLED1


for(i=0; i<1000000; i++);


               GPFDAT=nout & 0x00000030; //LED1/LED2


for(i=0; i<1000000; i++);


               GPFDAT=nout & 0x00000010; //LED1/LED2/LED3


for(i=0; i<1000000; i++);


               GPFDAT=nout & 0x00000000; //LED1/LED2/LED3/LED4


for(i=0; i<1000000; i++);


//led();


           }    


//return(0);


}


Phenomenon: LED1 and LED3 light up almost at the same time, LED2 lights up after a short while, LED4 lights up after a while, and then the cycle stops.


Note: Code-2 just adds a function in front of Code-1, but does not call it.



#define GPFCON (*(volatile unsigned long*)0x56000050)


#define GPFDAT (*(volatile unsigned long*)0x56000054)




int i,nout;


void led(void)


{


   GPFDAT=nout & 0x00000070;  


for(i=0; i<1000000; i++);


   GPFDAT=nout & 0x00000030;  


for(i=0; i<1000000; i++);


   GPFDAT=nout & 0x00000010;  


for(i=0; i<1000000; i++);


   GPFDAT=nout & 0x00000000;  


}


int Main()


{


      GPFCON = 0x00005500;


//GPFDAT = 0x00000050;


           nout=0x000000F0;


while(1)


           {


/*


               GPFDAT=nout & 0x00000070; //μãááLED1


               for(i=0; i<1000000; i++);


               GPFDAT=nout & 0x00000030; //LED1/LED2


               for(i=0; i<1000000; i++);


               GPFDAT=nout & 0x00000010; //LED1/LED2/LED3


               for(i=0; i<1000000; i++);


               GPFDAT=nout & 0x00000000; //LED1/LED2/LED3/LED4


               for(i=0; i<1000000; i++);


               */


               led();


           }    


//return(0);


}


Phenomenon: Same as Code-2 phenomenon



#define rGPFCON (*(volatile unsigned *)0x56000050)  


#define rGPFDAT (*(volatile unsigned *)0x56000054)


//#define rGPFUP (*(volatile unsigned *)0x56000058)  


void port_init(void)    


{




   rGPFCON=0x00005500;


// rGPFUP=0x0000ff;    


}


void led_on(void)  


{


int i,nout;


   nout=0x000000F0;


   rGPFDAT=nout & 0x00000070;  


for(i=0; i<100000; i++);


   rGPFDAT=nout & 0x00000030;  


for(i=0; i<100000; i++);


   rGPFDAT=nout & 0x00000010;  


for(i=0; i<100000; i++);


   rGPFDAT=nout & 0x00000000;  


for(i=0; i<100000; i++);


}


/*


void led_off(void)  


{


   int i,nout;


   nout=0;


   rGPFDAT=0;


   for(i=0; i<100000; i++);


   rGPFDAT=nout | 0x00000080;      


   for(i=0; i<100000; i++);


   rGPFDAT=nout | 0x00000040;      


   for(i=0; i<100000; i++);


   rGPFDAT=nout | 0x00000020;  


   for(i=0; i<100000; i++);


   rGPFDAT=nout | 0x00000000;  


   for(i=0; i<100000; i++);


}


void led_on_off(void)  


{


   int i;


   rGPFDAT=0;  


   for(i=0; i<100000; i++);


   rGPFDAT=0x000000F0;


   for(i=0; i<100000; i++);


}


*/


int main(void)


{


// port_init();


       rGPFCON=0x00005500;


while(1)


   {


       led_on();


// led_off();


// led_on_off();


   }


return(0);


}


/*


int i,nout;


void led(void)


{


   GPFDAT=nout & 0x00000070;  


   for(i=0; i<1000000; i++);


   GPFDAT=nout & 0x00000030;  


   for(i=0; i<1000000; i++);


   GPFDAT=nout & 0x00000010;  


   for(i=0; i<1000000; i++);


   GPFDAT=nout & 0x00000000;  


}


int Main()


{


      GPFCON = 0x00005500;


//GPFDAT = 0x00000050;



           nout=0x000000F0;


           while(1)


           {



               GPFDAT=nout & 0x00000070;  


               for(i=0; i<1000000; i++);


               GPFDAT=nout & 0x00000030;  


               for(i=0; i<1000000; i++);


               GPFDAT=nout & 0x00000010;  


               for(i=0; i<1000000; i++);


               GPFDAT=nout & 0x00000000;  


               for(i=0; i<1000000; i++);



               //led();


           }



      //return(0);


}


*/


Phenomenon: After downloading, the development board restarts directly when running y


analyze


At present, it seems that only Code-1 has achieved the desired effect. I have a lot of comments in the source code, but since they are all garbled when pasted, I deleted them all.


Code-1 and Code-2 should look the same on the PC platform, but the running results are very different. It should not be caused by the development board cache. It is probably caused by the compiler.


<1> Maybe MDK optimized the code, not the linker, but during compilation


<2>Code-4 causes the board to reboot directly. What is the reason?


It seems that I can't solve these two problems now. Let's put it aside for now and ask the teacher or the experts to help solve them next time.


Keywords:ARM  s3c2410 Reference address:【ARM】s3c2410 gpio debugging

Previous article:【ARM】s3c2410 interrupt processing example
Next article:【ARM】arm·ad converter

Recommended ReadingLatest update time:2024-11-17 13:37

In-depth understanding of ARM architecture (S3C6410) --- S3C6410 watchdog source code example
When the system operation is subject to external interference or system errors, the program sometimes runs away, causing the entire system to crash. It will set a period of time, and when this period is exceeded, it will jump out of the program and enter the interrupt handler. WatchDog is essentially a timer, so it sho
[Microcontroller]
In-depth understanding of ARM architecture (S3C6410) --- S3C6410 watchdog source code example
Analysis and Optimization of ARM7 Interrupt Process under μC/OSII
introduction At present, among embedded processor chips, the processor with ARM7 as the core is the most widely used one. It has multiple working modes and supports two different instruction sets (standard 32-bit ARM instruction set and 16-bit Thumb instruction set). μC/OSII is a preemptive, multi-tasking real-
[Microcontroller]
Analysis and Optimization of ARM7 Interrupt Process under μC/OSII
Design of car radio frequency identification anti-theft system based on ARM
  1. Introduction   With the development of RFID technology, car anti-theft devices are becoming more and more rigorous, complete and easy to use, and the development direction of car anti-theft is towards chip-type and network-type with higher intelligence. The car anti-theft system based on radio frequency identif
[Microcontroller]
Design of car radio frequency identification anti-theft system based on ARM
ARM study notes 15-basic principles of serial communication
Basic theory of computer serial port   1. What is a serial port? 2. What is RS-232? 3. What is RS-422? 4. What is RS-485? 5. What is a handshake?   1. What is a serial port? Serial ports are a very common protocol for device communication on computers (not to be confused with Universal Serial Bus or USB). Most compute
[Microcontroller]
Implementation of I2C device control method based on ARM
1 Introduction The I2C bus is a two-wire serial bus developed by Philips. It is widely used to connect microcontrollers and peripheral devices because of its simplicity, high efficiency and low interconnection cost. AT91SAM7X256 is an industrial-grade chip based on ARM7 launched by Atmel in 2005. It is valued
[Microcontroller]
Implementation of I2C device control method based on ARM
S3c2440ARM exception and interrupt system detailed explanation 8---timer interrupt program example
In this class we will write a timer interrupt service routine Use timer to realize light counting The reference material is Chapter 10 PWM TIMER Let's first show this structure diagram The structure of this diagram is very good There must be a clk (clock) in it. 1. Every time a clk (clock) comes, this TCNTn is r
[Microcontroller]
S3c2440ARM exception and interrupt system detailed explanation 8---timer interrupt program example
How to choose a development system for ARM beginners
  Many ARM beginners want to have a system that they can use, but they often have a wrong understanding that the higher the processor version and the higher the performance, the better, just like many people think that ARM9 and arm7 are good. I think beginners should be rational in this regard. The choice of developmen
[Microcontroller]
ARM MMU
Here is a summary of the three major functions of MMU: 1. Conversion from virtual address to physical address 2.Cache control 3. Memory access rights protection The Linux kernel uses three levels of page tables: PGD, PMD, and PTE. For many architectures, the PMD level has only one entry.
[Microcontroller]
ARM MMU
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号