Posts: 5
Threads: 1
Joined: Sep 2014
Hey!
Thank you for the great software.
It works great:
Initiating write...
Searching for bl . . . . . . .
Found PIC16F1783 fw ver. 1.0.2
Waiting for the boot loader to be ready...ok
Hex file successfully parsed
Writing flash....ok
Tx 387 bytes / Rx 14 bytes / 4,4s
Write successfully completed
However when i enable USE_TXENABLE it will just time out:
Initiating write...
Searching for bl . .
Found PIC16F1783 fw ver. 1.0.2
Waiting for the boot loader to be ready...ok
Hex file successfully parsed
Writing flash....response timed out
Write flash failed
Tx 8 bytes / Rx 4 bytes / 30,9s
Write failed
So how could i fix this?
Hoping for help.
Peeter
Posts: 623
Threads: 0
Joined: Nov 2009
Hi Peter,
Why do you want to use a tx enable pin if it works without?
Posts: 5
Threads: 1
Joined: Sep 2014
Hey Mikael!
I want to implement it for RS485. That is the reason.
Thank you for fast answer!
Posts: 5
Threads: 1
Joined: Sep 2014
Hey again.
I think i was misleading abit.
I am using bootloader over UART to USB and it is working. Now since i plan to use it with UART to RS485 to USB i was testing out this tx enable pin. I am stil using UART to USB and i am just hoping to watch the tx enable pin on oscilloscope. But as you can see if i enable this option it will not get contact anymore.
I hope it is clearer now
Thanks!
Peeter
Posts: 5
Threads: 1
Joined: Sep 2014
PHP Code:
;------------------------------------------------------------------------------
; Send()
;------------------------------------------------------------------------------
Send ; Enable tx
ifdef USE_TXENABLE
;bcf RCSTA_, CREN ;disable serial receiver ; COMMENTED OUT
movwf TEMP
banksel PORTR_TXE
bsf PORTR_TXE, PORTB_TXE;bank ?
movlw TXE_DELAY_CNT
movwf cnt1
txe_del_lo decfsz cnt1
goto txe_del_lo
movfw TEMP
endif
;Send byte
banksel TXREG_
movwf TXREG_ ;bank 0/3
; Wait for transmit shift register to get empty
banksel TXSTA_
txwait btfss TXSTA_, TRMT ;bank 1/3
goto txwait
; Disable tx
ifdef USE_TXENABLE
banksel PORTR_TXE
bcf PORTR_TXE, PORTB_TXE;bank ?
;bsf RCSTA_, CREN ;enable serial receiver ; COMMENTED OUT
endif
; Send complete
return
Hey!
I got it working by commenting out enable/disable serial receiver lines.
Why was it needed to enable/disable receiver?
Posts: 2
Threads: 0
Joined: Sep 2014
2014-09-22, 18:06:26
(This post was last modified: 2014-09-22, 18:07:46 by miklosch.)
Hello!
I have a same problem with PIC18F26K22.
I use RS485 line, and I can not write flash.
Error is:
Initiating write...
Searching for bl . . . . . .
Found PIC18F26K22 fw ver. 3.0.2
Waiting for the boot loader to be ready...ok
Hex file successfully parsed
Writing flash.... response timeout
Writing flash...
Write flash failed
Tx 164 bytes / Rx 9 bytes / 3s
Write failed
Or:
Initiating write...
Searching for bl .
Found PIC18F26K22 fw ver. 3.0.2
Waiting for the boot loader to be ready...ok
Hex file successfully parsed
Writing flash....unknown response 0xFF
Writing flash...
Write flash failed
Tx 159 bytes / Rx 9 bytes / 0,5s
Write failed
But I can write the eeprom with same config:
Initiating write...
Searching for bl . . . . . .
Found PIC18F26K22 fw ver. 3.0.2
Waiting for the boot loader to be ready...ok
Hex file successfully parsed
Writing eeprom...ok
Tx 454 bytes / Rx 68 bytes / 3,8s
Write successfully completed
It work without RS485 perfectly:
Initiating write...
Searching for bl .
Found PIC18F26K22 fw ver. 3.0.2
Waiting for the boot loader to be ready...ok
Hex file successfully parsed
Writing flash....ok
Writing eeprom...ok
Tx 3,9kB / Rx 160 bytes / 5,6s
Write successfully completed
Posts: 5
Threads: 1
Joined: Sep 2014
Hey!
Status update:
I got it working with RS485.
I belive the root problem is at uart.inc at function Send().
The last few statements are:
; Disable tx
PHP Code:
ifdef USE_TXENABLE
banksel PORTR_TXE
bcf PORTR_TXE, PORTB_TXE;bank ?
bsf RCSTA_, CREN ;enable serial receiver
endif
Now with this I cannot write flash memory.
I changed this to enable receiver as first instruction after send and now it is working:
PHP Code:
ifdef USE_TXENABLE
bsf RCSTA_, CREN ;enable serial receiver
banksel PORTR_TXE
bcf PORTR_TXE, PORTB_TXE;bank ?
endif
Another way to get this working is to just comment out disable/enable RX.
Maybe there is problem, where PC program is answering too fast and RX is still disabled at that moment?
Posts: 2
Threads: 0
Joined: Sep 2014
Posts: 623
Threads: 0
Joined: Nov 2009
Hi,
Thank you petspats for the report. I was able to reproduce the problem and fix it with your path. The problem is that the RCSTA register may be located in a different memory bank than the tx enable pin port register. I will publish a new version of the ds30 Loader free edition package when I get time.
miklosch: please start a separate thread.