New Micros, Inc  

Go Back   New Micros, Inc > IsoMax's ARM / TiniARM / Plug-an-ARM / Tini2106 / Tini2131 / Tini2138
User Name
Password
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 03-06-10, 06:39 AM
sobyrne sobyrne is offline
Registered User
 
Posts: 7
Serial communication with Tini2138 and Keil

I have been trying to get the Tini2138 ADC example to work with Keil v 4.03, using your example files.

The hex file that comes with the example loads fine via a serial bootloader and I can see it running in NMITerm.

However, when I try to compille the code to a hex file myself, although it compiles just fine nothing gets to the terminal when I try to run it.

The blinky code works just fine: it's only the codes that use printf that seem to have a problem (Hello, ADC, DAC).

Is there something in 4.03 that is so different to 3.5 that this would happen? I have tried using the retarget.c and the startup.s files from the new examples with these projects, but they still won't run. This is driving me nuts...

Sean
Reply With Quote
  #2  
Old 03-06-10, 12:11 PM
RMDumse RMDumse is offline
Moderator
 
Posts: 1,406
Hummm... unfortunately we don't have any visibility into Keil and their revision changes. But they would be the ones to answer this question.

Sounds by all rights your hardware is running correctly, loading and running. As you say, the hex file loads and runs, so the problem seems strictly related to the software and compilation process.

Do you have both versions, 3.5 and 4.03? We haven't upgraded since creating the examples, and the guy who did the examples left over a year ago. Historically, the printf is a huge chunk of code to include. Can you tell anything about the object sizes you're getting? Any chance it is too big for the space you've got? (Running a 2131 by chance?)
Reply With Quote
  #3  
Old 03-06-10, 08:23 PM
sobyrne sobyrne is offline
Registered User
 
Posts: 7
Serial communication with Tini2138 and Keil

Thanks for the quick reply.

I'm running the 2138 and this really is a small program, so I doubt memory limitations would be a problem. The hex file I generate is 7kB.

Also, even using puts() to send a string instead of printf() does not give anything on the serial output, which makes me think that perhaps the code is outputting to UART1 instead of UART0. Although the source makes it explicit that UART0 should be used.

I used to have an evaluation copy of 3.5, but got rid of it. I can only get version 4 from the Keil site, and they don't have a link to 3.5 anymore. I looked for the evaluation version of 3.5 elsewhere, but only got links to dubious torrent sites. I'm quite happy to use version 3.5 (or IAR or GCC or Crossworks or anything else that lets me output data to the serial port!).

I'll ask Keil as well. Not being able to run 'Hello world' is frustrating. I haven't even got to the real program design issues yet. Of course I'm pprobably just missing some simple compiler setting that would make it work, but I'm just at the point of learning to program these things and not comfortable enough to know what all the options do.

One other piece of information... the demo programs work fine under simulation in Keil 4.

This is a very nice microcontroller board, and I would really like to make it work.

Sean
Reply With Quote
  #4  
Old 03-06-10, 10:51 PM
RMDumse RMDumse is offline
Moderator
 
Posts: 1,406
Quote:
Originally Posted by sobyrne
Also, even using puts() to send a string instead of printf() does not give anything on the serial output, which makes me think that perhaps the code is outputting to UART1 instead of UART0. Although the source makes it explicit that UART0 should be used.


Well, maybe. So often on serial ports problems are something like set up. You know they aren't that hard that you couldn't try to drive them directly. Maybe avoid the built in routines, and go for them by the registers. Anyway that's probably the approach I'd take. Send one character, then when that works, send a second, and so on. Since blinky lights work, I'd signal what portion my program got to with some combination of lights, and figure it out step by step.
Reply With Quote
  #5  
Old 03-06-10, 11:30 PM
sobyrne sobyrne is offline
Registered User
 
Posts: 7
Serial communication with Tini2138 and Keil

Randy,

Yes, I did this. I wrote a program that flashes the LEDs (a la blinky) every time the 'Hello world' is supposed to show, with a down.-count from 10 to zero. The lights flash 10 times, then stop (as expected) but nothing comes through the serial port. I'll try to work out how to put the letters out to UART0 1 at a time as you suggest, just so I can see something on the terminal.

Can you tell me what the values for MSEL and PSEL should be for the Tini2138? The values in my Startup.S are 1F and 03, which correspond to M = 32 and P = 8. These seem too large for a 10 MHz crystal, but I probably don't understand exactly how these are set. I take it that the chip's clock is running at 60 MHz?

Sean
Reply With Quote
  #6  
Old 03-08-10, 01:55 AM
sobyrne sobyrne is offline
Registered User
 
Posts: 7
Quote:
Originally Posted by sobyrne
Randy,

Yes, I did this. I wrote a program that flashes the LEDs (a la blinky) every time the 'Hello world' is supposed to show, with a down.-count from 10 to zero. The lights flash 10 times, then stop (as expected) but nothing comes through the serial port. I'll try to work out how to put the letters out to UART0 1 at a time as you suggest, just so I can see something on the terminal.

Can you tell me what the values for MSEL and PSEL should be for the Tini2138? The values in my Startup.S are 1F and 03, which correspond to M = 32 and P = 8. These seem too large for a 10 MHz crystal, but I probably don't understand exactly how these are set. I take it that the chip's clock is running at 60 MHz?

Sean


OK, so I got it working. I had to mess around with a few values of parameters using the LPC21xx manual (Rev02). Here are the important variables I changed, in case someone else has this issue. I changed so much that I'm not sure what was the critical change. But these definitely helped.

PINSEL0 |= 0x00000005; // Enable TxD0 and RxD0
(in the Keil help file on serial communication, this was 0x00000050. That's why I was getting no serial output at all.)

U0FDR = 0x7C; // MULVAL = 7, DIVADDVAL=12
U0LCR = 0x83; // 8 bits, no Parity, 1 Stop bit
U0DLL = 0x09; // 38400 Baud Rate @ 15.0 MHZ PCLK , 7 12
U0DLM = 0; // High divisor latch = 0
U0LCR = 0x03; // DLAB = 0

MSEL: 6
PSEL: 4
MAM control: fully enabled
MAM Timing: 2

(This was set using the 'configuration wizard' tab below the editor page rather than by editing the file itself.)


The above settings give serial comms at 38400 baud. If anyone wants the hello example project, let me know.

Sean
Reply With Quote
  #7  
Old 03-08-10, 03:03 AM
sobyrne sobyrne is offline
Registered User
 
Posts: 7
In addition to what I just wrote, in v4 of Keil uVision there is a checkbox in the Target Options dialog under linker that says: 'Use memory layout from target dialog'. That needs to be checked too.

The options are:

Compiler:
-c --cpu ARM7TDMI -D__EVAL -g -O0 --apcs=interwork -I "C:\Keil\ARM\INC" -I "C:\Keil\ARM\INC\Philips" -o ".\Obj\*.o" --depend ".\Obj\*.d"


Assembler:
--cpu ARM7TDMI --pd "__EVAL SETA 1" -g --apcs=interwork -I "C:\Keil\ARM\INC" -I "C:\Keil\ARM\INC\Philips" --list ".\Lst\*.lst" --xref -o "*.o"


Linker:
--cpu ARM7TDMI *.o --strict --scatter ".\Obj\Hello.sct"
--autoat --summary_stderr --info summarysizes --map --xref --callgraph --symbols

Hope this helps someone.

Sean
Reply With Quote
  #8  
Old 10-01-10, 05:46 AM
billzimmerly billzimmerly is offline
Registered User
 
Posts: 15
Smile Appreciation

Sean,

Thank you for posting your solutions.

Sincerely,
- Bill
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is On
Forum Jump



All times are GMT -5. The time now is 09:38 PM.


Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.