Mercurial > public > hwos_code
comparison src/external_flash.asm @ 421:3895adc3477f
fix Page-Program timing
author | heinrichsweikamp |
---|---|
date | Fri, 29 Apr 2016 16:40:10 +0200 |
parents | 789230298511 |
children | ccaaac45b61a |
comparison
equal
deleted
inserted
replaced
420:789230298511 | 421:3895adc3477f |
---|---|
180 movwf temp1 ; store data byte | 180 movwf temp1 ; store data byte |
181 bsf flash_ncs ; CS=1 | 181 bsf flash_ncs ; CS=1 |
182 movlw 0x06 ; WREN command | 182 movlw 0x06 ; WREN command |
183 rcall write_spi | 183 rcall write_spi |
184 bsf flash_ncs ; CS=1 | 184 bsf flash_ncs ; CS=1 |
185 movlw 0x02 ; Write command | 185 movlw 0x02 ; Write (PP, Page-Program) command |
186 rcall write_spi | 186 rcall write_spi |
187 rcall ext_flash_write_address ; Write 24bit address ext_flash_address:3 via SPI | 187 rcall ext_flash_write_address ; Write 24bit address ext_flash_address:3 via SPI |
188 movf temp1,W ; load data byte | 188 movf temp1,W ; load data byte |
189 rcall write_spi ; write one byte of data! | 189 rcall write_spi ; write one byte of data! |
190 bsf flash_ncs ; CS=1 | 190 bsf flash_ncs ; CS=1 |
191 return | 191 bra ext_flash_wait_write ; And return... |
192 ; | |
193 ; | |
194 ; return | |
192 | 195 |
193 global ext_flash_disable_protection ; Disable write protection | 196 global ext_flash_disable_protection ; Disable write protection |
194 ext_flash_disable_protection: | 197 ext_flash_disable_protection: |
195 ; unlock old memory | 198 ; unlock old memory |
196 bsf flash_ncs ; CS=1 | 199 bsf flash_ncs ; CS=1 |
271 rcall write_spi | 274 rcall write_spi |
272 rcall ext_flash_write_address ; Write 24bit address ext_flash_address:3 via SPI | 275 rcall ext_flash_write_address ; Write 24bit address ext_flash_address:3 via SPI |
273 bsf flash_ncs ; CS=1 | 276 bsf flash_ncs ; CS=1 |
274 ; bra ext_flash_wait_write ; Wait for write... and return | 277 ; bra ext_flash_wait_write ; Wait for write... and return |
275 ext_flash_wait_write: | 278 ext_flash_wait_write: |
276 WAITMS d'5' ; TBE/TSE=25ms... | 279 WAITMS d'1' ; TBE/TSE=25ms... |
277 movlw 0x05 ; RDSR command | 280 movlw 0x05 ; RDSR command |
278 rcall write_spi ; Read status | 281 rcall write_spi ; Read status |
279 rcall write_spi ; Read status into WREG | 282 rcall write_spi ; Read status into WREG |
280 bsf flash_ncs ; CS=1 | 283 bsf flash_ncs ; CS=1 |
281 btfsc SSP2BUF,0 ; Write operation in process? | 284 btfsc SSP2BUF,0 ; Write operation in process? |