How do you stimulate the UART in Studio4

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can see how you stimulate a regular i/o port with the stimulus file.

Is it possible to get UART input ? Or would I have to produce the actual start bit... stop bit on the RXD pin with the correct cycle timing?

Foreground code that waits in a loop can be changed by manually altering the loop condition. Can you force a RX interrupt manually ?

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You might try setting up a USART in the simulator and logging the Tx output you want to Rx later into a log file. Since the log and stimuli file share the same format, you could edit the Tx log to move the Tx pin data to the Rx data bit position, then use the modified log as a USART input stimulus file. The instructions on stimuli are a bit vague, so I'm only guessing about most of it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Mike.

I wrote the bit output to a stimulus file on the PC cos I cannot get the PORTD to log every bit to the log file.

So if I then do the simulation, with the UART bits coming in to PIND.0 of a Mega32.

Studio4 sets PIND accordingly, but there is no USART response.

It does say in the Studio4 help that you cannot work the USART via stimulus files. Worth trying though.

So the only thing that I can do is to "Break", set the RXC bit, and have another breakpoint where UDR is actually read by the program. Manually put in a value to UDR.

I would presume that the action of writing to UDR might also set off a TX as well, but I am not checking that.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I could be wrong but I think if you read the notes for the specific proceesors you will find that the UART is not simulated. I would try loading the data register with a value and linking a pin chnage or other interrupt to the UART interrupt routine. That is about the best I've come up with.

We never have time to do it right,
but we always have time to do it over

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
I can see how you stimulate a regular i/o port with the stimulus file.

Is it possible to get UART input ? Or would I have to produce the actual start bit... stop bit on the RXD pin with the correct cycle timing?

Foreground code that waits in a loop can be changed by manually altering the loop condition. Can you force a RX interrupt manually ?

David.

HAPSIM
Helmi's AVR Periphery Simulator
http://www.helmix.at/hapsim/