hdmi
hdmi copied to clipboard
something wrong in audio
Hi, I have something strange in audio signal. It looks like some bits are not reflected or are mixed up. I tried sawtooth example with some changes. Code is here:
logic signed [15:0] audio_sample_word = 16'sd0;
logic signed [15:0] audio_sample_word_minus = 16'sd0;
always @(posedge audio_clk) // Sawtooth wave
begin
audio_sample_word <= audio_sample_word + 16'sd1;
audio_sample_word_minus <= audio_sample_word_minus - 16'sd128;
end
..
hdmi #(.VIDEO_ID_CODE(17), .VIDEO_REFRESH_RATE(50), .AUDIO_RATE(48000), .AUDIO_BIT_WIDTH(16)) hdmi(
...
.clk_pixel(clk_pixel),
.clk_audio(audio_clk),
.rgb(rgb),
.audio_sample_word({audio_sample_word,audio_sample_word_minus}),
result is here:

This exaple is for 16bits audio. I have found when want use 24bits the highest two bits are not reflected and have to use this:
.audio_sample_word({{2'b0,audio_r,6'b0},{2'b0,audio_l,6'b0}}),
Could you help me with this issue, please.
Hi Jan,
I'm not aware of any particular logic that would cause that. Could you share the changes you made to that code to use 24 bit audio? That way I can look into this issue with the top testbench. Also, did you already try using a non-signed representation?
Hi Sameer, sorry for confusion second problem is not related to 24bits audio, but with 44100Hz sample rate. I use this code:
logic clk_audio;
logic [8:0] audio_divider;
always_ff@(posedge clk_pixel)
begin
if (audio_divider<9'd306-1) audio_divider++; //generated from clk_pixel 27.0000MHz/281=48042,70Hz ; 27.0000MHz/306=44117,64Hz
else begin clk_audio<=~clk_audio; audio_divider<=0; end
end
logic [23:0] audio_sample_word [1:0] = '{24'sd0, 24'sd0};
always_ff@(posedge clk_audio)
begin
audio_sample_word[0] <= audio_sample_word[0] + 128; //sawtooth generator
audio_sample_word[1] <= audio_sample_word[1] - 256;
end
logic [23:0] rgb = 24'd0;
logic [9:0] cx, cy, screen_start_x, screen_start_y, frame_width, frame_height, screen_width, screen_height;
// Border test (left = red, top = green, right = blue, bottom = blue, fill = black)
always_ff@(posedge clk_pixel)
rgb <= {cx == screen_start_x ? ~8'd0 : 8'd0, cy == screen_start_y ? ~8'd0 : 8'd0, cx == frame_width - 1'd1 || cy == frame_height - 1'd1 ? ~8'd0 : 8'd0};
hdmi #(.VIDEO_ID_CODE(17), .VIDEO_REFRESH_RATE(50), .AUDIO_RATE(44100), .AUDIO_BIT_WIDTH(24)) hdmi(
.clk_pixel_x10(clk_pixel_x10),
.clk_pixel(clk_pixel),
.clk_audio(clk_audio),
.rgb(rgb),
.audio_sample_word(audio_sample_word),
.tmds_p(dvdata_p),
.tmds_clock_p(dvclk_p),
.tmds_n(dvdata_n),
.tmds_clock_n(dvclk_n),
.cx(cx),
.cy(cy),
.screen_start_x(screen_start_x),
.screen_start_y(screen_start_y),
.frame_width(frame_width),
.frame_height(frame_height),
.screen_width(screen_width),
.screen_height(screen_height)
);
and look at how is signal produced.
When I change sample rate to 48000Hz the signal has nice sawtooth shape.
Hi,
l think you are successful to set up and show.
I use the test pattern to test, there are always two block shown.
Is my screen not supported? or something wrong?
Did you have some ideas?
https://imgur.com/ArIkfPk
Hi mopplayer,
Could you create a separate issue for this? Also, what model of TV/monitor are you using?
On Wed, Sep 14, 2022, at 19:42, mopplayer wrote:
Hi,
l think you are successful to set up and show.
I use the test pattern to test, there are always two block shown.
Is my screen not supported? or something wrong?
Did you have some ideas?
https://imgur.com/ArIkfPk
— Reply to this email directly, view it on GitHub https://github.com/hdl-util/hdmi/issues/27#issuecomment-1247511175, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACUVICGBIJFQ6ERZMLGVE6TV6KEIZANCNFSM5DUAW5XQ. You are receiving this because you commented.Message ID: @.***>
Hi @sameer,
I have created another issue.
Thank you very much.
Should be resolved by https://github.com/hdl-util/hdmi/commit/08936f65be09abac338cd8c13beee289af7e7e59