 |
 |
View previous topic :: View next topic |
Author |
Message |
ciccioc74
Joined: 23 Mar 2010 Posts: 41
|
|
Posted: Thu Feb 13, 2025 3:41 am |
|
|
Quote: | This is why I prefer to give UART streams names that correspond to the
physical UART they use, so you 'know' which port is involved. |
sorry could you give me an example? |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19765
|
|
Posted: Thu Feb 13, 2025 6:39 am |
|
|
So the stream that connects to the RS485, and uses UART4, call something
line RS485_U4. Then the handler is for INT_RDA4. If you change to using
a different UART, change the stream name to correspond to what UART it
uses, and any discrepancy becomes obvious.
I suspect you are actually reading the wrong UART in one of your interrupt
handlers, and hence the lockup. |
|
 |
ciccioc74
Joined: 23 Mar 2010 Posts: 41
|
|
Posted: Thu Mar 13, 2025 11:53 am |
|
|
I had set aside the bootloader issue to focus on other things, but now I'd like to understand where the problem is. Analyzing the .lst file, I noticed that something doesn't add up. Could you help me figure out what's wrong?
Code: |
CCS PCD C Compiler, Version 5.119d, 1 13-mar-25 18:38
Compiler operating in Evaluation Mode
To obtain a fully enabled compiler visit www.ccsinfo.com/products |
in the ISR timer2:
Code: | ................... #INT_TIMER2
.................... void my_timer2_isr (){
*
019FC: PUSH 42
019FE: PUSH 36
01A00: PUSH 32
01A02: MOV W0,[W15++]
01A04: MOV #2,W0
01A06: REPEAT #C
01A08: MOV [W0++],[W15++]
.................... if(++cont_1s>100){//0,5 seconds
01A0A: INC 0802
01A0C: MOV 802,W4
01A0E: MOV #64,W3
01A10: CP W3,W4
01A12: BRA GE,1A1A
.................... cont_1s=0;
01A14: CLR 802
.................... output_toggle(PIN_D15);
01A16: BCLR.B 2D9.7
01A18: BTG.B 2DD.7
.................... }
.................... }
01A1A: BCLR.B 84.7
01A1C: MOV #1A,W0
01A1E: REPEAT #C
01A20: MOV [--W15],[W0--]
01A22: MOV [--W15],W0
01A24: POP 32
01A26: POP 36
01A28: POP 42
01A2A: RETFIE |
focus on the line :01A1A: BCLR.B 84.7
in the ISR USART3:
Code: | .................... #INT_RDA3
.................... void myRXisr(){
*
01A3A: PUSH 42
01A3C: PUSH 36
01A3E: PUSH 32
01A40: MOV W0,[W15++]
01A42: MOV #2,W0
01A44: REPEAT #C
01A46: MOV [W0++],[W15++]
.................... U3RXIF=0;
01A48: BCLR.B 8E.2
.................... do{
.................... temp= fgetc(UART3);
01A4A: CALL 1A2C
01A4E: MOV.B W0L,804
01A50: CLR.B 805
.................... output_toggle(LED3);
01A52: BCLR.B 2D1.5
01A54: BTG.B 2D5.5
.................... } while (kbhit(UART3));
01A56: BTSC.B 252.0
01A58: BRA 1A4A
.................... }
01A5A: BCLR.B 8E.2
01A5C: MOV #1A,W0
01A5E: REPEAT #C
01A60: MOV [--W15],[W0--]
01A62: MOV [--W15],W0
01A64: POP 32
01A66: POP 36
01A68: POP 42
01A6A: RETFIE |
focus on the 01A5A: BCLR.B 8E.2
but on the interrupt of serial4: Code: |
.................... #INT_RDA4
.................... void myRXisr485(){
01A6C: PUSH 42
01A6E: PUSH 36
01A70: PUSH 32
01A72: MOV W0,[W15++]
01A74: MOV #2,W0
01A76: REPEAT #C
01A78: MOV [W0++],[W15++]
.................... U4RXIF=0;
01A7A: BCLR.B 8F.0
.................... // do{
.................... // temp= fgetc(UART4);
.................... // output_toggle(LED4);
.................... // } while (kbhit(UART4));
.................... }
....................
01A7C: BCLR.B 8F.0
01A7E: MOV #1A,W0
01A80: REPEAT #C
01A82: MOV [--W15],[W0--]
01A84: MOV [--W15],W0
01A86: POP 32
01A88: POP 36
01A8A: POP 42
01A8C: RETFIE |
the line 01A7C: BCLR.B 8F.0 clear 8F.0 bit but U4RXIF is located at 8E.8. could you explain to me why? |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19765
|
|
Posted: Fri Mar 14, 2025 2:24 am |
|
|
16bit registers........
0x8e, if accessed as a 16bit register has bit 8 as U4RXIF. However you can
also perform an _8bit_ access to the next address up to access the same
bit.
BCLR.W 8E.8 == BCLR.B 8F.0 ***** not actually possible see below.
The data sheet describes the registers with 16bit values and addresses.
However the code to talk to the bit set/reset, uses 8bit addressing and
values.
The reason is that the BLCR.W version, can only be used on a W reg,
not on any memory address. So to do the same with word addressing,
you would have to read the 16bit word into a W reg, then use BCLR.W
on this register, and then write this back. Three instructions, where the bit
addresed 'byte' version does it in one. |
|
 |
ciccioc74
Joined: 23 Mar 2010 Posts: 41
|
|
Posted: Fri Mar 14, 2025 2:43 am |
|
|
Ok. Thank. |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|