FPGA|CPLD|ASICwilliam hill官网
直播中

乔海权

11年用户 53经验值
擅长:可编程逻辑 电源/新能源 模拟技术 测量仪表 EMC/EMI设计 嵌入式技术 制造/封装 存储技术 CRF/无线 接口/总线/驱动 处理器/DSP 光电显示 控制/MCU EDA/IC设计 RF/无线 MEMS/传感技术
私信 关注
[经验]

【DIGILENT挑战赛】arty artix 7- 35t 测试第5篇 问题解决,点亮屏幕

1. 我之前以为是电源不够,所以外加的12V 1A的电源,一直不行。所以上个帖子求助william hill官网 ,在此特别感谢 william hill官网 ID:左岸cpx 这个大神,帮助我。
2. 我自己之前尝试过很多次,软件版本从V1升级到 V8,想必各位理解我的付出的努力和尝试,各种看资料。
1.png
3.  vivado 的版本一直 到 5,可谓各种办法都试过。
4.  感谢william hill官网 ID:左岸cpx,感谢这些前辈的分享经验
5.  digilent 在官网说过 MTDS库在 arty板子上测试过,但是没有提供 Multi-Touch Display Shield这个屏幕的例程。
6. 按照新下载的MTDS例程
    https://forum.digilentinc.com/to ... oard/#comment-14912
7. 下载 zip文件
1.png


8. 这个时候,下载的工程打开后不能直接使用,需要重新添加 Ip核,参考上个帖子。
9. 按照上个帖子的流程,启动 xilinx SDK , 下载 FPGA, run 起来,终于在屏幕上看到了动静。
IMG_20170427_204441.jpg
IMG_20170427_204504.jpg
IMG_20170427_204510.jpg
10. 当然这个时候需要去探究SDK里面的C++怎么实现的了。
11. 我检查vivado 的引脚配置的时候,发现 CS引脚是 C1,但是在 屏幕的原理图发现CS引脚不对应的,
      猜测,原理图可能有问题。
1.png
12. 在 main.c++里面
int main ()
{
        EnableCaches();
        setup();
        while(1)
        {
                loop();
        }
        return 0;
}


其实主要是 setup这个函数,打开他
fStat = mtds.begin(pinMtdsSelStd, frqMtdsSpiDefault); 这个函数有2个参数,pinMtdsSelStd是 配置CS片选引脚,frqMtdsSpiDefault是 SPI的时钟频率
发现主要是 mtds 这个对象,打开它的类,所有函数都在里面了。如果需要实现什么功能,直接调用MTDS里面的函数即可,同时官方提供了7个 demo, 都可以试一试。
class MTDS {
        friend class MTFS;
        friend class MTWS;

private:
        bool                fInitialized;
        uint8_t                clsLastError;
        uint8_t                cmdLastError;
        uint8_t                staLastError;
        uint32_t        tusElapsed;
        bool                fUpdating;

protected:

        bool        MtdsSyncChannel();
        void        MtdsProcessCmdWr(uint8_t cls, uint8_t cmd, uint16_t cbParam, uint8_t * pbParam,
                                                                uint16_t cbData, uint8_t * pbData);
        void        MtdsProcessCmdRd(uint8_t cls, uint8_t cmd, uint16_t cbParam, uint8_t * pbParam,
                                                                uint16_t cbData, uint8_t * pbData);
        bool        FCheckName(char * sz, uint8_t cls, uint8_t cmd);
        bool        FBeginUpdate();

public:
                                MTDS();
                           ~MTDS();
        bool                begin();
        bool                begin(int pinSel, uint32_t frqSpi);
        void                end();

        /* General control and status functions.
        */
        bool                FInitialized()                        { return fInitialized; };
        bool                FInitDisplay();
        bool                GetVersionInfo(VINFO * pvinfo);
        uint8_t                GetLastError()                        { return staLastError; };
        uint8_t                GetLastError(uint8_t * pcls, uint8_t * pcmd);
        uint32_t        GetElapsedTime()                { return tusElapsed; };
        bool                EnableStatusPin(int idPin, int fEn);
        bool                GetStatusPin(int idPin);
        bool                SetStatusPin(int idPin, int st);
        bool                SetDisplayEnable(uint32_t st);
        uint32_t        GetDisplayEnable();
        bool                SetDisplayOrientation(uint32_t dso);
        uint32_t        GetDisplayOrientation();
        bool                SetDisplayBacklight(uint32_t val);
        uint32_t        GetDisplayBacklight();
        uint32_t        SetBacklightMode(uint32_t val);
        bool                ClearDisplay(uint16_t clr);
        bool                SetTchSensitivity(uint32_t val);
        uint32_t        GetTchSensitivity();
        bool                SetTchMoveDelta(int16_t dxco, int16_t dyco);
        bool                GetTchMoveDelta(int16_t * pdxco, int16_t * pdyco);
        uint32_t        GetMsgStatus();
        bool                ClearMsgQueue();
        bool                PeekMsg(MEVT * pevt);
        bool                GetMsg(MEVT * pevt);
        bool                PostMsg(MEVT * pevt);
        bool                PushMsg(MEVT * pevt);
        uint32_t        GetFreeMem();
        bool                GetMemStatus(MSTAT * pmstat);
        bool                SetMemMode(uint32_t mm);
        HMEM                AllocMem(uint32_t cbReq);
        uint32_t        GetMemSize(HMEM hmem);
        bool                FreeMem(HMEM hmem);
        bool                ReadMem(HMEM hmem, uint32_t ibRead, uint32_t cbRead, uint8_t * rgbBuf, uint32_t * PCBRes);
        bool                WriteMem(HMEM hmem, uint32_t ibWrite, uint32_t cbWrite, uint8_t * rgbBuf, uint32_t * pcbRes);
        bool                FirmwareUpdate(char * szName);
        uint8_t                GetUpdateStatus();
        bool                SetDateTime(DTM * pdtm);
        bool                GetDateTime(DTM * pdtm);

        /* GDI graphics functions
        */
        HDS                        GetDisplayDs();
        HDS                        GetDs();
        bool                ReleaseDs(HDS hds);

        HBMP                CreateBitmap(int16_t dxco, int16_t dyco, int16_t cbpp);
        bool                DestroyBitmap(HBMP hbmp);
        bool                GetBitmapDimensions(HBMP hbmp, BMPD * pbmpd);
        HBMP                GetDisplayBitmap();
        HBR                        CreateSolidBrush(uint32_t clr);
        HBR                        CreatePatternBrush(int16_t ids, uint32_t clrFg, uint32_t clrBg);
        HBR                        CreateCustomBrush(HBMP hbmp);
        bool                DestroyBrush(HBR hbrDel);

        uint32_t        GetNearestColor(uint32_t clr);
        bool                SetFgColor(HDS hds, uint32_t clr);
        uint32_t        GetFgColor(HDS hds);
        bool                SetBgColor(HDS hds, uint32_t clr);
        uint32_t        GetBgColor(HDS hds);
        bool                SetTransColor(HDS hds, uint32_t clr);
        uint32_t        GetTransColor(HDS hds);
        bool                SetIntensity(HDS hds, int ity);
        int                        GetIntensity(HDS hds);
        bool                SetPen(HDS hds, uint16_t pen);
        uint16_t        GetPen(HDS hds);
        bool                SetBkMode(HDS hds, int bkReq);
        int                        GetBkMode(HDS hds);
        bool                SetDrwRop(HDS hds, int drwReq);
        int                        GetDrwRop(HDS hds);
        bool                SetBrush(HDS hds, HBR hbrReq);
        HBR                        GetBrush(HDS hds);
        bool                SetFont(HDS hds, HFNT hfntReq);
        HFNT                GetFont(HDS hds);
        bool                SetDrawingSurface(HDS hds, HBMP hbmp);
        HBMP                GetDrawingSurface(HDS hds);

        bool                StoreBitmap(char * szName, HBMP hbmp);
        HBMP                LoadBitmap(char * szName);
        bool                SndBitmap(char * szName, uint8_t * pbmp);
        bool                RcvBitmap(char * szName, int cbMax, uint8_t * pbmp);
        bool                StoreFont(char * szName, HFNT hfnt);
        HFNT                LoadFont(char * szName);

        bool                SetPixel(HDS hds, int16_t xco, int16_t yco, uint32_t clr);
        uint32_t        GetPixel(HDS hds, int16_t xco, int16_t yco);
        bool                GetCurPos(HDS hds, PNT * ppnt);
        bool                MoveTo(HDS hds, int16_t xco, int16_t yco);
        bool                MoveTo(HDS hds, PNT * ppnt)                        { return MoveTo(hds, ppnt->xco, ppnt->yco); };
        bool                Line(HDS hds, int16_t xco, int16_t yco);
        bool                Line(HDS hds, PNT * ppnt)                        { return Line(hds, ppnt->xco, ppnt->yco); };
        bool                LineTo(HDS hds, int16_t xco, int16_t yco);
        bool                LineTo(HDS hds, PNT * ppnt)                        { return LineTo(hds, ppnt->xco, ppnt->yco); };
        bool                PolyLine(HDS hds, int cpnt, PNT * rgpnt);
        bool                PolyLineTo(HDS hds, int cpnt, PNT * rgpnt);
        bool                Arc(HDS hds, int16_t xcoLeft, int16_t ycoTop, int16_t xcoRight, int16_t ycoBottom,
                                                        int16_t xcoRad1, int16_t ycoRad1, int16_t xcoRad2, int16_t ycoRad2);
        bool                ArcTo(HDS hds, int16_t xcoLeft, int16_t ycoTop, int16_t xcoRight, int16_t ycoBottom,
                                                        int16_t xcoRad1, int16_t ycoRad1, int16_t xcoRad2, int16_t ycoRad2);
        bool                Ellipse(HDS hds, int16_t xcoLeft, int16_t ycoTop, int16_t xcoRight, int16_t ycoBottom);
        bool                Chord(HDS hds, int16_t xcoLeft, int16_t ycoTop, int16_t xcoRight, int16_t ycoBottom,
                                                        int16_t xcoRad1, int16_t ycoRad1, int16_t xcoRad2, int16_t ycoRad2);
        bool                Pie(HDS hds, int16_t xcoLeft, int16_t ycoTop, int16_t xcoRight, int16_t ycoBottom,
                                                        int16_t xcoRad1, int16_t ycoRad1, int16_t xcoRad2, int16_t ycoRad2);
        bool                Rectangle(HDS hds, int16_t xcoLeft, int16_t ycoTop, int16_t xcoRight, int16_t ycoBottom);
        bool                RoundRect(HDS hds, int16_t xcoLeft, int16_t ycoTop, int16_t xcoRight, int16_t ycoBottom,
                                                        int16_t dxcoWidth, int16_t dycoHeight);

        bool                TextOut(HDS hds, char * szText);
        bool                TextOut(HDS hds, int cchText, char * rgchText);
        bool                TextOut(HDS hds, int16_t xco, int16_t yco, int cchText, char * rgchText);
        bool                GetTextExtent(HDS hds, int cchText, char * rgchText, PNT * pntExtent);

        bool                BitBlt(HDS hdsDst, int16_t xcoDst, int16_t ycoDst, int16_t dxco, int16_t dyco, HDS hdsSrc, int16_t xcoSrc, int16_t ycoSrc, uint16_t rop);
        bool                PatBlt(HDS hdsDst, int16_t xco, int16_t yco, int16_t dxco, int16_t dyco, uint16_t rop);
        bool                DrawBitmap(HDS hdsDst, int16_t xcoDst, int16_t ycoDst, int16_t dxco, int16_t dyco, HDS hdsSrc, int16_t xcoSrc, int16_t ycoSrc);

        bool                IsRectEmpty(RCT * prct);
        bool                IsRectEqual(RCT * prct1, RCT * prct2);
        bool                PointInRect(RCT * prct, int16_t xco, int16_t yco);
        bool                PointInRect(RCT * prct, PNT pnt)        { return PointInRect(prct, pnt.xco, pnt.yco); };
        void                SetRectEmpty(RCT * prct);
        void                SetRect(RCT * prct, int16_t xcoLeft, int16_t ycoTop, int16_t xcoRight, int16_t ycoBottom);
        void                SetRect(RCT * prctDst, RCT * prctSrc);
        void                MoveRect(RCT * prct, int16_t dxco, int16_t dyco);
        void                GrowRect(RCT * prct, int16_t dxco, int16_t dyco);
        bool                IntersectRect(RCT * prctDst, RCT * prctOne, RCT * prctTwo);
        bool                UnionRect(RCT * prctDst, RCT * prctOne, RCT * prctTwo);
        bool                FrameRect(HDS hds, RCT * prct);
        bool                FillRect(HDS hds, RCT * prct, HBR hbr);
        bool                InvertRect(HDS hds, RCT * prct);
};


13. 这次学到很多,主要是软核处理器,和 外设接口的使用,在最上层全部是 C++实现。
  • IMG_20170427_204456.jpg

回帖(1)

陈彭鑫

2017-4-28 13:39:34
Congrats           !        
举报

更多回帖

发帖
×
20
完善资料,
赚取积分