Today, USB devices have entered every aspect of our work and life, and they have brought us a lot of convenience. Therefore, having USB functionality has become a basic requirement for many systems now. The S3C4510B developed by Samsung for arm7 is a chip that is currently used very frequently in the industry. Its powerful functions make it the terminator of many traditional 51 and other series of microcontroller development ideas. By transplanting the uClinux operating system to it, it is like adding wings to a tiger. The stable Linux system and the powerful S3C4510B hardware are closely combined to form a powerful development platform and bring new development concepts. This article uses the EMBEST S3C4510B development board developed by Shenzhen Embest Company. It introduces the expansion of USB-HOST based on the SL811HS (HOST) developed by CYPRESS Company on such a powerful platform; it demonstrates the differences between traditional system development based on this platform. Brand new ideas while further enriching the functionality of the system.
1 Expansion board hardware circuit design
When Embest's development board based on uClinux2.4.x+S3C4510B is implemented, the program is placed in ROM/ARAM/FLASH group 0 whose base address is controlled by ROMCON0; when the system starts, the program placed in this group is copied to SDRAM0 Group. This article assigns the address of SL811HS to ROM/ARAM/Flash group 1, controls its base address by ROMCON1, and uses external interrupt 0 to receive the interrupt signal of SL811HS. Since SL811HS does not separate the data and address buses, D0~D7 will be time-shared and multiplexed. This is controlled by the A0 line of SL811HS; when A0 is low, address information is transmitted on D0~D7; when A0 is high, data information is transmitted on D0~D7. Therefore, ADDR10 of S3C4510B is used to control A0, thereby separating the data of SL811HS from the internal address.
2 Kernel modification
To configure SL811HS to Bank1 controlled by ROMCON1, the main application is to make changes to the following two files.
①…armnommusnds100.h
Will Line216
#define DSR1 (0<<2)
Change to:
#define DSR1 (1<<2)
This will define Bank1 as 8-bit byte mode.
Change Line 249
#define rROMCON1 0x0
Change to:
#define ROM_BASE1_R ((0x00200000>>16)<<10)
#define ROM_NEXT1_R (0x00300000>>16)<<20)
#definerROMCON1_R(ROM_NEXT1_R|ROM_BASE1_R|tACC0|tPA0|PMC0)
#define rROMCON0_B
(ROM_NEXT1_B|ROM_BASE1_tACC0|tPA0|PMC0)
Here ROM_x_R refers to the value after the system is reset and is also the value when the system is started. ROM_x_B means that after the system is started, the program must be copied to SDRAM for running, so the original FLASH-BANK0 can no longer use address 0, but SDRAM0 should use address 0. This ROM_x_B is the new address of the corresponding Flash group when the program is running in SDRAM.
②….s
Will line 162
ldr r1,=0x200000
Change to ldr r1,=0x300000
This tells the system how much space to copy from Flash storage to SDRAM.
Will line 259
.word rROMCON1
Change to .word rROMCON1_R
Will line 272
.word rROMCON1
Change to .word rROMCON1_B
In this way, the configuration values of rROMCON1 in reset and boot modes are saved in different registers. However, when the program is running, it is not determined by this value, but by rROMCON1, so the program must assign one of the values in these two modes to rROMCON1 at the appropriate time for system use.
3 Hardware circuit detection
After the above two steps, the SL811HS is configured to ROM/ARAM/Flash group 1 controlled by rROMCON1. Its data port address is 0x1200400 and the address port address is 0x1200000. The interrupt is external interrupt 0. You can use the following small program to test whether the internal registers of SL811HS can be read and written correctly.
/***filename:test811.c****/
int main(void){
unsigned char *addr,*data,I,j,x,val;
int k,m;
addr=0x1200000;
data=0x1200400;
for(i=0x10;i<0x100;i++)
{mywriteb(i,addr);
mywriteb(i,data);}
printf("test now!");
for(i=0x10;i<0x100;i++)
{mywriteb(i,addr);
val=myreadb(data);
if(val!=i)
printf("error in test address %d",i);}
}
char myreadb(int addr)
{ unsigned char *addr1;
unsigned char data;
addr1=addr;
data=*addr1;
return(data);}
void mywritten(unsigned char data,int addr)
{ unsigned char*addr1;
addr1=addr;
*addr=data;}
Compile the program as an application together with the kernel. For specific methods, please refer to the file/documentation/adding-user-apps-howto.txt;
After the kernel is compiled and passed, it is downloaded to the development board, then the system is started, and the host computer uses Hyper Terminal to monitor. After the system boots, run the application. If there are no errors, the hardware is connected correctly.
4 driver transplantation
The USB-HOST (SL811HS) driver does not need to be written separately. There are ready-made codes in the Linux kernel for reference, or you can download them from the CYPRESS website. However, this driver is designed for sal100, so corresponding changes must be made before it can be used on our S3C4510B system.
The changes here are mainly modifications to the file hc_s1811.c. This file is located in…/driver/usb/
First, you need to modify the hardware address, because the data and address port addresses of SL811HS are 0x1200400 and 0x1200000 respectively. Modify lines 106 and 107
static int base_addr=0xd3800000;
static int data_reg_addr=0xd3810000;
is static int base_addr=0x1200000;
static int data_reg_addr=0x1200400;
Modify lines 130 and 131
#define SL811HC_IOPORT0 0xa000000
for #define SL811HC_IOPORT0 0x1200000
#define SL811HC_IODATAPORT0 0x120040
Since the interrupt of SL811HS is assigned as interrupt 0, the line 108 should be modified.
static int irq=34;
is static int irq=0;
Modify line 139
#define Sl811HC_IRQ0 27
for #define SL811HC_IRQ0 0
And the function void init_irq(void) needs to be rewritten
for void init_irq(void)
{
INT_ENABLE(irq);
IntPend=0x1FFFFF;
IntMode=INT_MODE_IRQ;
}
Then start kernel compilation. When configuring the kernel, select the SL811HS item, burn the successfully compiled kernel to the board, and then start it. Using the host computer's HyperTerminal monitoring, you can see that the system has allocated resources such as addresses and interrupts to SL811HS. At this point, the extension of USB-HOST is completed.
Conclusion
The wide application of USB devices makes many systems consider extending it to meet the needs of customers. This article introduces the detailed steps of expanding SL811HS (host) on Embest's EMBEST3SC4510B development board, and gives a self-written test program, which provides a simple and powerful tool for hardware detection and porting USB for further development. Device drivers provide the hardware platform.
Previous article:Design of embedded CCD image data acquisition system based on USB bus
Next article:Implementing CAN bus intelligent node in μCOS-II on S3C44B0
Recommended ReadingLatest update time:2024-11-23 12:41
- Popular Resources
- Popular amplifiers
- Microgrid Stability Analysis and Control Microgrid Modeling Stability Analysis and Control to Improve Power Distribution and Power Flow Control (
- MATLAB and FPGA implementation of wireless communication
- Introduction to Internet of Things Engineering 2nd Edition (Gongyi Wu)
- Siemens PLC Programming Technology and Application Cases (Edited by Liu Zhenquan, Wang Hanzhi, Yang Kun, etc.)
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- MOS tube controls the resonant frequency of the LC resonant circuit
- Forum Spring Festival Duty Schedule
- Power consumption of monochrome LCD screen
- Driving of light-emitting diodes for lighting and dedicated driving power converter
- Some problems encountered when using spartan6 PLL IP Core
- Books purchased with E-coins
- P1dB Specifications for the MAX2116 Satellite Tuner
- Help
- [ST Motor Review] 1. Familiarity with the Development Kit
- I would like to ask if anyone has disassembled this kind of antenna?