电子大神的日记本,供应链专家的功夫茶盘,在这里记录、分享与共鸣。

登录以开始

S3C44B0对外部SDRAM的访问

S3C44BO支持的数据宽度为8位、16位、32位三种类型,我的S3C44BO开发板上的数据宽度是16位的,SDRAM也是16位宽的,所以要将寄存器BWSCON寄存器的相关位进行如下设置,具体设置那些位要根据SDRAM所链接到片选引脚,我的SDRAM和S3C44B0的nGCS6引脚链接,所以必须设置该寄存器的DW6标志位,也就是[25:24]两位为01,同样的道理,设置的规律如下:

           片选引脚        对应的标志          数据宽度         设置的值

             nGCS0           DW0                         8                          00

                                                                     16                         01

                                                                     32                         10

             nGCS1           DW1                        8                           00

                                                                     16                         01

                                                                      32                        10

             nGCS2          DW2                          8                           00

                                                                     16                         01

                                                                      32                        10

             nGCS3          DW3                          8                           00

                                                                     16                         01

                                                                      32                        10

             nGCS4          DW4                          8                           00

                                                                     16                         01

                                                                      32                        10

             nGCS5          DW5                          8                           00

                                                                     16                         01

                                                                      32                        10

             nGCS6          DW6                          8                           00

                                                                     16                         01

                                                                      32                        10 

             nGCS7          DW7                          8                           00

                                                                     16                         01

                                                                      32                        10  

对于硬件开发人员来说,还必须注意OM1:OM0这两个引脚,这两位决定了bank0的总线宽度

但是大家都知道,S3C44BO是32位的,如果要访问SDRAM,比如要像外部SDRAM中写入一个unsigned int型数据,或者要从外部空间读取一个unsigned int型数据,我们编程的时候是否需要读两次然后移位组成一个32位的数据呢,如果我们是写入,是否需要先写16位,再移位写剩下的16位呢,显然程序根本就不用这么设计,可以用示波器测量SDRAM的片选引脚,我们发现当写入或者读出一个unsigned int型数据时,nGCSX会自动变低两次,也就是说我们编写程序时只需一次而其他的都由硬件完成了,我们只能看到读出或者写入了32位,硬件通过两次读写完成了对SDRAM的访问,同样如果把位宽设置成8位,当访问外部空间时,nGCSX管脚则会变低四次以完成一个unsigned int型数据的访问。这些都是脚毛蒜皮的事情,编程时可以不予理睬,但是理解这些对理解S3C44B0是大有益处的,所以贴出来和大家共享,共同进步。

博主
qinfeng2002
qinfeng2002's Blog
qinfeng2002
点击跳转