Control FG085 from serial port

Control FG085 from serial port

Postby jye1 » Tue Aug 27, 2013 5:24 pm

Dear folks, we recently received email from a customer asking for information about the rotary encoder. He was doing a project to control FG085 from an Arduino by emulating the keypad. Inspired by his project we modified the firmware to allow the instrument be controllable via the serial port. This could be interesting to those who want FG085 work in a programmatic way. Please see attachment for the hex file and document. Any feedback is appreciated.

The firmware is for chip U5. It was based on firmware version 113-08501-130. It has everything that -130 has. Please remember also upgrade U6 to 113-08502-050 if it contains earlier version. Otherwise the instrument won't work correctly.

113-08512-011.rar
(15.38 KiB) Downloaded 476 times

DN085-12v02_HowToControlFG085ViaSerialPort.rar
(566.17 KiB) Downloaded 638 times
jye1
 
Posts: 1221
Joined: Wed Feb 20, 2013 4:58 pm

Re: Control FG085 from serial port

Postby jye1 » Wed Sep 04, 2013 9:13 pm

A bug found (thanks to Yuzo from Japan!) in the firmware which caused frequency can not be changed from serial connection unless manual change has been done at least once. This is the corrected one:
113-08512-012.rar
(15.36 KiB) Downloaded 489 times
jye1
 
Posts: 1221
Joined: Wed Feb 20, 2013 4:58 pm

Re: Control FG085 from serial port

Postby vsoft » Sun Sep 15, 2013 10:49 am

I have ordered the FG085 just because it allows programmatic control.

The How To Control document says:

Because microcontrollers (or PC) could send button codes much faster than that from key pad
it will cause button codes lost if FG085 can not handle quick enough. To prevent this from
happening you can send special button code 0xA1 which enables postpone code reception
until the present code has been processed.


Two questions:

1. How fast does FG085 handle commands? How many times per second it can change frequency and amplitude? Any estimates?
2. Please explain how the postpone code reception works. Would it hold writing from my PC application to a serial port (via USB)?
vsoft
 
Posts: 10
Joined: Sat Sep 14, 2013 10:12 am

Re: Control FG085 from serial port

Postby jye1 » Tue Sep 24, 2013 10:50 pm

There is a 300-byte FIFO reception buffer for the serial port. Incoming data are saved to the buffer by background subroutines. At foreground the microcontroller handles keypad, serial buffer, and display in turn in the main loop. At serial buffer handling, once started, it normally will process all saved bytes in the buffer before exit. This would result in button loss if multiple button frames have already been saved in the buffer when the microcontroller starts the processing. What the special button code 0xA1 does was to tell the microcontroller do not process next button until a received button has been executed.

By estimation most buttons (from the keypad or serial port) are handled in milliseconds because they usually only affect display change. Unit buttons, which terminate an input sequence, could take about 100 ms to execute due to the communication with the DDS chip (U6, ATmega48).

The microcontroller only returns character 'G' when a frame is successfully received. It does not affect any PC activities. It is the responsibility of external applications to hold off sending to avoid overflowing the 300-byte reception buffer.
jye1
 
Posts: 1221
Joined: Wed Feb 20, 2013 4:58 pm

Re: Control FG085 from serial port

Postby vsoft » Wed Sep 25, 2013 5:07 am

Thank you, it sounds clear!
vsoft
 
Posts: 10
Joined: Sat Sep 14, 2013 10:12 am

Re: Control FG085 from serial port

Postby jye1 » Tue Oct 08, 2013 3:34 am

Another special command was added to place cursor to intended location (i.e. Freq, Amp, or Ofs). This command only takes effect when the generator is under CW mode. With this command remembering cursor position is not required.

Updated document and firmware:

DN085-12v03_HowToControlFG085ViaSerialPort.rar
(549.89 KiB) Downloaded 565 times


113-08512-013.rar
(15.45 KiB) Downloaded 502 times
jye1
 
Posts: 1221
Joined: Wed Feb 20, 2013 4:58 pm

Re: Control FG085 from serial port

Postby vsoft » Thu Oct 24, 2013 6:25 pm

The new commands that set current cursor position are very helpful, thank you very much!

Everything works fine as can be seen on this short video:
http://www.youtube.com/watch?v=NbYevaa57f0

The only problem is that control frames are sometimes ignored even though they are acknowledged by 'G' response - that is my first impression after a few hours of experiments with the FG.
For example, sending a sequence of frames to set amplitude like 0xa2, 'A', '0', '.', '5','3','1','H' (here I only show the frame payload for clarity sake) might set the value 0.3 V, and then within ~200ms all frames are apparently ignored.

I expected shorter latency - though I understand that the device has not been designed as a musical instrument.

There is just one command missing: it would make me totally satisfied if I could set desired waveform regardless of the current selection.
vsoft
 
Posts: 10
Joined: Sat Sep 14, 2013 10:12 am

Re: Control FG085 from serial port

Postby jye1 » Sat Oct 26, 2013 12:42 am

Thank you for the video. Unfortunately it couldn't be opened within China :( .

For the sequence you gave the amplitude should be set to 0.5V and '3', '1' would be dropped because of resolution limitation.

I will think about adding a waveform selection command. Ideally all parameters should be able to be set by straightforward commands. Because there is very little (about 1%) code space left we can't implement that way. Waveform selection is relatively simple. I think it should be ok.
jye1
 
Posts: 1221
Joined: Wed Feb 20, 2013 4:58 pm

Re: Control FG085 from serial port

Postby vsoft » Sat Oct 26, 2013 8:49 pm

http://victorx.eu/live/fg085s.zip

A short snippet of the video.
vsoft
 
Posts: 10
Joined: Sat Sep 14, 2013 10:12 am

Re: Control FG085 from serial port

Postby jye1 » Sat Oct 26, 2013 11:52 pm

Thank you for the video. The shown behavior was correct. Frequency resolution is 1Hz. Amplitude and offset resolution is 0.1V. Any extra digits entered will be truncated.
jye1
 
Posts: 1221
Joined: Wed Feb 20, 2013 4:58 pm

Next

Return to FG085

Who is online

Users browsing this forum: No registered users and 2 guests

cron