• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
:::

論壇索引


Board index » All Posts (b9015038)




請問如何匯出MHC的Pin Configuration
#21
資深會員
資深會員


我開了新專案檔,用MHC指定了周邊使用的pin腳,然後我想要把pin腳的定義匯出成表格給layout的人

我搜尋了一下,以前好像是有這個功能的(可匯出成xls?),參考
但我現在找不到匯出的地方


請問現在MHC可以匯出pin腳位的定義嗎?應該怎麼操作?

發表於: 2021/9/8 13:49

Edited by Libra on 2021年09月13日 08:05:28
頂部


關於用Address來存取Ram的內容
#22
資深會員
資深會員


在Bootloader APP中有一段程式是

#define BTL_TRIGGER_PATTERN (0x5048434DUL)
#define BTL_TRIGGER_RAM_START  0x20000000U
static uint32_t *ramStart = (uint32_t *) BTL_TRIGGER_RAM_START;

                
ramStart[0] = BTL_TRIGGER_PATTERN;
                
ramStart[1] = BTL_TRIGGER_PATTERN;
                
ramStart[2] = BTL_TRIGGER_PATTERN;
                
ramStart[3] = BTL_TRIGGER_PATTERN;
                
DCACHE_CLEAN_BY_ADDR(ramStart16);
                
NVIC_SystemReset();


功能應該是在RAM中寫入標記,表示應執行bootloader流程,然後reset到bootloader的地方開始動作

我在自己的APP中加入這一段的時候,跑到ramStart[0] = BTL_TRIGGER_PATTERN;時,
就跳到HardFault,我原本以為是因為RAM範圍設定的關係,因為範例要求設定
RAM_LENGTH=0x3fff0
RAM_ORIGIN
=0x20000010

來保留上面的bootloader記號使用的範圍,但我把BTL_TRIGGER_RAM_START 改成可用的RAM位址一樣會錯,
所以我覺得是不是有什麼設定值在保護直接用ADDR來存取RAM的內容?

我從官網上的說明沒有看到相關的內容

不知道有沒有相關的說明可以參考?

發表於: 2021/7/16 16:05
頂部


SAME54 usb_host_msd_bootloader範例,test_app build for debugging時無法產生hex檔
#23
資深會員
資深會員


MPLAB X 5.35,XC32 v3.00

我在測試範例usb_host_msd_bootloader時,按照範例說明用預設的build,從production目錄拿bin檔,更新動作是正常的

因為我想測試一下其它的功能,比如說:
- 修改bootloader size、
- 從test_app的configuration中的Loading直接載入bootloader專案、
- 將設定值分成offset、combine、standalone

所以我複製了一份範例來修改,發現test_app無法build出debug用的hex檔(即無法跑debug模式),按Debug Main Project時,最後會出錯,顯示

InfoLoading file: ./..srcconfigsam_e54_xproATSAME54P20A.ld
make
[2]: Leaving directory 'G:/Microchip/Projects/usb_host_msd_bootloader/test_app/firmware/sam_e54_xpro.X'
"--------------------------------------"
"User defined post-build step: ["
C:Program FilesMicrochipxc32v3.00bin"/xc32-objcopy -I ihex -O binary dist/sam_e54_xpro/debug/sam_e54_xpro.X.debug.hex dist/sam_e54_xpro/debug/sam_e54_xpro.X.debug.bin]"
C:Program FilesMicrochipxc32v3.00binbin/pic32m-objcopy.exe'dist/sam_e54_xpro/debug/sam_e54_xpro.X.debug.hex'No such file
make
[1]: *** [nbproject/Makefile-sam_e54_xpro.mk:111: .build-confError 255
make
: *** [nbproject/Makefile-impl.mk:39: .build-implError 2
make
[1]: Leaving directory 'G:/Microchip/Projects/usb_host_msd_bootloader/test_app/firmware/sam_e54_xpro.X'

BUILD FAILED (exit value 2total time3s)


此時從dist目錄的子目錄debug中,找不到hex檔
test_app預設是從位址0xA000開始放程式,而且沒有設定合併bootloader,所以原本也不能直接跑,可能是故意不給產生debug hex,但我想自己合併bootloader專案檔來跑單步


請問有什麼設定值可讓debug模式時不產生hex檔?

發表於: 2021/7/15 10:28
頂部


Re: 請教操作QSPI Flash的觀念(讀寫資料用)
#24
資深會員
資深會員


那我這樣問好了

從DataSheet上看到的Product Memory Mapping Overview,可以看到QSPI的位址範圍
參考畫面


從MPLAB X中測試QSPI的static void qspi_memcpy_32bit(uint32_t* dst, uint32_t* src, uint32_t count)
可發現它寫入時是用0x04000000加入Offset來操作的,下圖是我設成從128Mb的位址開始寫入
參考執行畫面

從上面的圖看到當操作128Mb以上時,addr會大於0x05000000,已經大於第一張圖的QSPI定址範圍了,如果它可以支援4-Byte address mode的話,是怎麼做的?

下面的QSPI_MemoryWrite中,QSPI_ADDR 的定義是_UL_(0x04000000)

bool QSPI_MemoryWriteqspi_memory_xfer_t *qspi_memory_xferuint32_t *tx_datauint32_t tx_data_lengthuint32_t address )
{
    
uint32_t *qspi_mem = (uint32_t *)(QSPI_ADDR address);
    
uint32_t length_32bitlength_8bit;

    if (
qspi_setup_transfer(qspi_memory_xferQSPI_INSTRFRAME_TFRTYPE_WRITEMEMORY_Valaddress) == false)
    {
        return 
false;
    }

    
/* Write to serial flash memory */
    
length_32bit tx_data_length 4;
    
length_8bit tx_data_length 0x03;

    if(
length_32bit 0)
    {
        
qspi_memcpy_32bit(qspi_memtx_datalength_32bit);
    }
    
tx_data tx_data length_32bit;
    
qspi_mem qspi_mem length_32bit;

    if(
length_8bit 0)
    {
        
qspi_memcpy_8bit((uint8_t *)qspi_mem, (uint8_t *)tx_datalength_8bit);
    }
    
__DSB();
    
__ISB();

    
QSPI_EndTransfer();

    while((
QSPI_REGS->QSPI_INTFLAG QSPI_INTFLAG_INSTREND_Msk) != QSPI_INTFLAG_INSTREND_Msk)
    {
            
/* Poll Status register to know status if instruction has end */
    
}

    
QSPI_REGS->QSPI_INTFLAG |=  QSPI_INTFLAG_INSTREND_Msk;

    return 
true;
}

發表於: 2021/6/25 14:53
頂部


Re: 請教操作QSPI Flash的觀念(讀寫資料用)
#25
資深會員
資深會員


關於操作256Mb的部份,我在SAME54的DataSheet中的Product Memory Mapping Overview看到,
QSPI的Addr範圍是:0x04000000 -> 0x05000000
即可操作的範圍只有0x01000000 = 16MB = 128Mb

我找了SAM E70系列來比對,它們的QSPI範圍是:0x80000000 -> 0xA0000000
官網上寫著:
Quad I/O Serial Peripheral Interface (QSPI) interfacing up to 256 MB Flash and with eXecute-In-Place and on-the-fly scrambling
這顆的QSPI操作範圍是0X20000000 = 512MB,我不太確定它是跑XIP時只能到256MB還是當Data Flash也只能到256MB,我沒要用這顆就不太關心了

版大可以幫忙確認一下,SAME54這個說明就是只支援到128Mb的意思?

因為我在讀寫時,把INSTRFRAME的ADDRLEN設成1也是沒用,一樣跳到HardFault

發表於: 2021/6/25 10:44
頂部


Re: 請教操作QSPI Flash的觀念(讀寫資料用)
#26
資深會員
資深會員


感謝回覆,

您使用18F來操作,3秒寫入一次33Bytes
這33Bytes是佔用一個Page的空間?不然索引值可能不太好算,跨sector時會有點麻煩

Flash每次寫入時應該要備份一次sector的內容,erase後再寫回去,不然每寫一次該sector的其它資料就不見了…
PIC18能開出4096的buffer?一次用掉16個bank只為了當備份sector的buffer,感覺有點心痛啊

所以您的流程是:複製sector到buffer --> erase --> 將修改的buffer寫入Flash嗎?

發表於: 2021/6/24 12:46
頂部


請教操作QSPI Flash的觀念(讀寫資料用)
#27
資深會員
資深會員


我想用Flash操作Page的讀寫來存取資料

以前用的都是SPI的NAND Flash,操作時page的寫入命令會自動執行erase再寫進去,看起來比較單純

QSPI的NOR Flash看起來操作差異比較大,我找了一陣子資料,整理一下它的特色:
- earse最小單位為4k (有的叫subsector,有的叫sector)

- 讀取時可隨意指定addr(因它有x decoder, y decoder,可將輸入的addr轉為page index,及page內的位置)

- 模組直接mapping到MCU的address,以SAME54為例是QSPI_ADDR (0x04000000)

我看了一下範例(Harmony\V3\csp_apps_sam_d5x_e5x\apps\qspi\qspi_read_write)
裡面不管是SST26或N25Q256A,都是初始化後先erase 1個sector,然後在這個sector裡寫點資料再讀出來。

對QSPI Nor Flash有些問題:(操作使用MHC產生的plib_qspi.c)

- 在寫入Flash時,plib中提供
bool QSPI_MemoryWriteqspi_memory_xfer_t *qspi_memory_xferuint32_t *tx_datauint32_t tx_data_lengthuint32_t address )

csp網頁中的說明:
This function can be used to write maximum of one page of data to the specified address of the serial flash device connected as a QSPI slave.
裡面addr並沒有做限制,function的實作是設定命令為CMD_PAGE_PROGRAM之後就開始複製資料,沒有執行erase的動作,請問
- 想要寫入資料時,只要執行QSPI_MemoryWrite,還是必須先執行erase?

- addr是以page size為單位,即 (size%256)來當作addr?

我的應用裡,須要寫入的資料有好幾類,會把Flash分成幾段,每段寫入不同種類的資料。

資料都不大,但會不斷連續寫入(至少一分鐘寫入一次),若每次寫入都須要先erase 4k,頻繁的清除/寫入對NOR Flash好像不太好?NOR Flash好像是較適合不常寫入,常讀出的應用?


會想用NOR Flash (256Mb)一方面是開發板(SAME54)上有,想說有範例code較容易上手,但這個範例的用法過於簡略,看不出若是要反覆讀寫時應該怎麼做。(是否須要每次先Erase?)
(範例甚至無法讀寫整顆Flash,因size大於128Mb,預設的addr只有3byte)

另一方面QSPI不包含在sercom裡,用這顆的話可以省一組Sercom,就多了一組通訊介面可用

請問若應用是像這樣至少每分鐘會寫入(加上其它不定時其它類型事件),是否不適合使用NOR Flash?(我擔心頻繁的小資料寫入會讓flash很快就掛掉)

麻煩有用過的先進給些建議,謝謝

Plib中的實作
bool QSPI_MemoryWriteqspi_memory_xfer_t *qspi_memory_xferuint32_t *tx_datauint32_t tx_data_lengthuint32_t address )
{
    
uint32_t *qspi_mem = (uint32_t *)(QSPI_ADDR address);
    
uint32_t length_32bitlength_8bit;

    if (
qspi_setup_transfer(qspi_memory_xferQSPI_INSTRFRAME_TFRTYPE_WRITEMEMORY_Valaddress) == false)
    {
        return 
false;
    }

    
/* Write to serial flash memory */
    
length_32bit tx_data_length 4;
    
length_8bit tx_data_length 0x03;

    if(
length_32bit 0)
    {
        
qspi_memcpy_32bit(qspi_memtx_datalength_32bit);
    }
    
tx_data tx_data length_32bit;
    
qspi_mem qspi_mem length_32bit;

    if(
length_8bit 0)
    {
        
qspi_memcpy_8bit((uint8_t *)qspi_mem, (uint8_t *)tx_datalength_8bit);
    }
    
__DSB();
    
__ISB();

    
QSPI_EndTransfer();

    while((
QSPI_REGS->QSPI_INTFLAG QSPI_INTFLAG_INSTREND_Msk) != QSPI_INTFLAG_INSTREND_Msk)
    {
            
/* Poll Status register to know status if instruction has end */
    
}

    
QSPI_REGS->QSPI_INTFLAG |=  QSPI_INTFLAG_INSTREND_Msk;

    return 
true;
}

發表於: 2021/6/23 9:45
頂部


Re: SAME54-請教SAMPCTRL.SAMPLEN的作用
#28
資深會員
資深會員


感謝指導

因此從表45-1得到,若選擇Accumulation Averaging模式時,ADC就會被設定成12bit?

我看到關於CTRLB.RESSEL的說明,選擇For averaging mode output時,表上的16BIT應該不是指解析度?

還是說此時ADC是12bit,但被放在16bit的暫存器中做累加?

因為選擇Accumulation Averaging模式時,上面沒有顯示ADC是多少bit,Table 45-1. Accumulation中有一欄Final Result Precision,但單純的累加應該不會讓解析度增加吧?

發表於: 2021/6/11 13:01
頂部


SAME54-請教SAMPCTRL.SAMPLEN的作用
#29
資深會員
資深會員


我在MHC的ADC裡看到有一個設定是Select Sample Length (Cycles),DataSheet的說明:
說明1
說明2

看起來只是把取樣時間拉長,但並沒有說明這樣的作用是什麼。
我設得比較長的話,取樣會比較準嗎?還是有什麼其它的作用?

另外我看到有一個AVGCTRL.SAMPLENUM (Accumulation),說明上看起來是可以設定取樣次數,然後就可以自動累加後輸出,但MHC上沒有看到可以設定的地方

相關說明在SAM E5x Family Data Sheet的45.6.2.9 Accumulation與45.6.2.10 Averaging

我須要偵測外部輸入的電壓,如果它裡面可以自動多取幾次再取平均值輸出的話,就可以比較方便的拿到較準的結果,請問有相關的設定方式嗎?

發表於: 2021/6/11 8:32
頂部


Re: 請問Harmony 3沒有靜態與動態驅動可選?
#30
資深會員
資深會員


可以參考AN3388 (MPLAB Harmony v3 Application Development Guide for MPLAB Harmony v2 Users)

其中在8.2、8.3有相關的說明,v3應該是都用dynamic,如果是static它建議直接用plib...


幫你貼一下相關內容
--------------------------------------------------------------
8.2 Static Driver
If an MPLAB Harmony v2 application uses the static driver, it can be developed on MPLAB Harmony v3 in two ways:
1. Instead of the MPLAB Harmony v2 static driver, the MPLAB Harmony v3 PLIB can be used. Application Example Using MPLAB Harmony v3 PLIBS shows an example.
2. Instead of the MPLAB Harmony v2 static driver, the MPLAB Harmony v3 dynamic driver can be used.
Application Example Using MPLAB Harmony v3 Driver shows an example.


8.3 Dynamic Driver
If an MPLAB Harmony v2 application uses the dynamic driver, it can be developed on MPLAB Harmony v3 by using the MPLAB Harmony v3 dynamic driver. Application Example Using MPLAB Harmony 3 Driver shows an example.

發表於: 2021/6/11 8:20
頂部



« 1 2 (3) 4 5 6 ... 18 »



:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------