EmbeddedRelated.com
Forums
Memfault Beyond the Launch

HCS12 SCI Flash Programming Help

Started by jssimbe November 5, 2009
I'm using and HCS12 with icc12 compiler. I'm using SCI1 to communicate to a touch screen LCD. This program loads the LCD GUI. When I try loading the program into flash, it doesn't work. When I'm not using flash, the program works fine and GUI is loaded on the screen. When I flash the board, I include the vectors_dp256 file and set the abs_address to 0xef80. Any help would be greatly appreciated. Thanks.

#include
#include

#ifndef TDRE
#define TDRE 0x80
#endif
#ifndef RDRF
#define RDRF 0x20
#endif
#ifndef OR
#define OR 0x08
#endif

void main (){

sc_init();
loadscreen();
}

void sc_init(){

SCI1BDL = 0x4E; // 19200 Baud Rate
SCI1BDH = 0x00;
SCI1CR1 = 0x00;
SCI1CR2 = 0x2C;
SCI1SR1 = 0xA8;
}
void outchar(data1){ // Function to send commands

while(!(SCI1SR1 & TDRE)){};
SCI1DRL = data1;
}

void loadscreen (){ //loads GUI

outchar(0x10);
outchar(0x02);
outchar(0x3E);
outchar(0x00);
outchar(0x50);

}

Hi,

Below, the vector interrupt table I use for DP256...
Note the address I put it is 0xff80, not 0xef80...
I use ICC12 too, and it run OK for interrupt.
When I used DP256, I often write some functions in RAM, but I never change
the vector table address, just switched RAM to 0xd000 with NoIce debugger.

Hope this helps.

Best regards.
Joel

//*********************************************************
// change the address if your vector starts elsewhere
// Processeur 9S12DP256 : vecteurs interruptions en 0xff80
#pragma abs_address:0xFF80

void (*interrupt_vectors[])(void) =
{
// to cast a constant, say 0xb600, use (void (*)())0xb600
// Tous les vecteurs interrupt occupent 2 octets consutifs. Ainsi
// l'adresse de la routine d'interruption RTI est dinie aux
// adresses $FFF0-$FFF1
ISR_NonDeveloppe, // Reserved $FF80
ISR_NonDeveloppe, // Reserved $FF82
ISR_NonDeveloppe, // Reserved $FF84
ISR_NonDeveloppe, // Reserved $FF86
ISR_NonDeveloppe, // Reserved $FF88
ISR_NonDeveloppe, // Reserved $FF8A
ISR_NonDeveloppe, // $FF8C PWM Emergency Shutdown
ISR_NonDeveloppe, // $FF8E Port P Interrupt
ISR_NonDeveloppe, // $FF90 MSCAN 4 Transmit
ISR_NonDeveloppe, // $FF92 MSCAN 4 Receive
ISR_NonDeveloppe, // $FF94 MSCAN 4 Error
ISR_NonDeveloppe, // $FF96 MSCAN 4 Wake-up
ISR_NonDeveloppe, // $FF98 MSCAN 3 Transmit
ISR_NonDeveloppe, // $FF9A MSCAN 3 Receive
ISR_NonDeveloppe, // $FF9C MSCAN 3 Error
ISR_NonDeveloppe, // $FF9E MSCAN 3 Wake-up
ISR_NonDeveloppe, // $FFA0 MSCAN 2 Transmit
ISR_NonDeveloppe, // $FFA2 MSCAN 2 Receive
ISR_NonDeveloppe, // $FFA4 MSCAN 2 Error
ISR_NonDeveloppe, // $FFA6 MSCAN 2 Wake-up
ISR_NonDeveloppe, // $FFA8 MSCAN 1 Transmit
ISR_NonDeveloppe, // $FFAA MSCAN 1 Receive
ISR_NonDeveloppe, // $FFAC MSCAN 1 Error
ISR_NonDeveloppe, // $FFAE MSCAN 1 Wake-up
ISR_NonDeveloppe, // $FFB0 MSCAN 0 Transmit
ISR_NonDeveloppe, // $FFB2 MSCAN 0 Receive
ISR_NonDeveloppe, // $FFB4 MSCAN 0 Error
ISR_NonDeveloppe, // $FFB6 MSCAN 0 Wake-up
ISR_NonDeveloppe, // $FFB8 Flash
ISR_NonDeveloppe, // $FFBA EEPROM
ISR_NonDeveloppe, // $FFBC SPI2
ISR_NonDeveloppe, // $FFBE SPI1
ISR_NonDeveloppe, // $FFC0 IIC Bus
ISR_NonDeveloppe, // $FFC2 BDLC
ISR_NonDeveloppe, // $FFC4 CRG Self Clock Mode
ISR_NonDeveloppe, // $FFC6 CRG PLL Lock

ISR_NonDeveloppe, // $FFC8 Pulse Acc B Overflow
ISR_TimerModulus, // $FFCA Modulus Down Counter
Underflow

ISR_NonDeveloppe, // $FFCC Port H Interrupt
ISR_NonDeveloppe, // $FFCE Port J Interrupt
ISR_NonDeveloppe, // $FFD0 ATD1
ISR_NonDeveloppe, // $FFD2 ATD0
ISR_Sci1, // $FFD4 SCI1
ISR_Sci0, // $FFD6 SCI0

ISR_NonDeveloppe, // $FFD8 SPI0
ISR_NonDeveloppe, // $FFDA Pulse Acc A Input Edge
ISR_NonDeveloppe, // $FFDC Pulse Acc A Overflow

ISR_NonDeveloppe, // $FFDE Timer Overflow
ISR_Timer7, // $FFE0 Timer Channel 7
ISR_Timer6, // $FFE2 Timer Channel 6
ISR_Timer5, // $FFE4 Timer Channel 5
ISR_Timer4, // $FFE6 Timer Channel 4
ISR_Timer3, // $FFE8 Timer Channel 3
ISR_Timer2, // $FFEA Timer Channel 2
ISR_Timer1, // $FFEC Timer Channel 1
ISR_Timer0, // $FFEE Timer Channel 0
ISR_Rti, // $FFF0 Real Time
Interrupt
ISR_NonDeveloppe, // $FFF2 IRQ
ISR_NonDeveloppe, // $FFF4 XIRQ
ISR_NonDeveloppe, // $FFF6 SWI
ISR_NonDeveloppe, // $FFF8 Unimplement Instr. Trap
ISR_NonDeveloppe, // $FFFA COP failure reset
ISR_NonDeveloppe, // $FFFC Clock monitor fail reset
_start, // $FFFE Reset
};

-----Message d'origine-----
De: 6... [mailto:6...] De la part de
jssimbe
Envoy vendredi 6 novembre 2009 02:29
: 6...
Objet: [68HC12] HCS12 SCI Flash Programming Help

I'm using and HCS12 with icc12 compiler. I'm using SCI1 to communicate to a
touch screen LCD. This program loads the LCD GUI. When I try loading the
program into flash, it doesn't work. When I'm not using flash, the program
works fine and GUI is loaded on the screen. When I flash the board, I
include the vectors_dp256 file and set the abs_address to 0xef80. Any help
would be greatly appreciated. Thanks.


Memfault Beyond the Launch