valentina lomi

Problems with uart_putchar in M52235.

Discussion created by valentina lomi on Feb 7, 2007
Latest reply on Feb 8, 2007 by CrasyCat
Hallo everyone,
I have a problem with my M52235 board.
I used Codewarrior stationery for my board, then simply write down this main:
 
int main()
{
 uart_putchar(0,'a');
 
 while(1); // Idle
 
 return 0;
 }
 
where putchar is the predefined function I find in the uart.c file in the Codewarrior stationery
(prototype: void uart_putchar (int channel, char ch))
It doesn't work.
I examined the assembly generated after compiling and I realized that char 'a' is first stored in register d0 (32 bit) then pushed to the stack (pushing 4 bytes).
When loading UART TX buffer, only one byte of the four bytes on the stack is taken, and it is the most significant one. Hence, as 'a' is 0x00000062, only byte 0x00 is loaded to the TX buffer.
What is happening?
Is it a problem of little endian/ big endian mismatch?
Can anyone help me?
Thank you
 
Valentina

Outcomes