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
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- Matrix keyboard program problem
- [GD32L233C-START Review] (4) LPTIMER wake-up trigger ADC in Sleep low power mode
- [Qinheng RISC-V core CH582] Development environment installation
- High salary recruitment: European sales manager (German required)
- Application Notes on Flash Serial Programming for HuaDa MCU F003/F005/L110 Series
- MSP430 register detailed classification
- EEWORLD University Hall----Open Source PWM Robotic Arm (Arduion Version)
- 1MHz square wave double frequency
- CC3200 Modify the sprinkler routine of Out of Box
- Upgrading the embedded RISC-V compiler