Thursday, August 6, 2020

JQ8400 MP3 Voice Module Microe C code

Previously I wrote a post about well-known voice module of DFPlayer Mini. Today I would like to write a post of advance chip, JQ8400. The main advantages of this chip are;

  • Inquiry of the file name
  • Inquiry of duration of the current audio
  • Inquiry of playback duration
  • Fast backward
  • Fast forward, etc.
jq8400 module
Jq8400 Module

JQ8400 module is a SOC solution that combines a 16bit MCU with an ADSP specialized in audio decoding. By using hardware decoding method, it ensures system stability, quality of sound, and small footprint matching requirements of embedded applications. For the flexibility of R&D, control commands can be sent via one-line mode or RS232 serial communication.
It adopts full duplex serial communication protocol: Baud rate 9600, 8-bit data, no parity and 1 stop bit.

Message Format

Starting Code + Command Code + Data Length + Data 1 – Data n + Checksum
  • Starting Code: fixed as “AA” (in hex)
  • Command Code: 01 – 26 (in hex)
  • Data Length: respective data bytes in commands; length=1 stands for command only, no data.
  • Checksum: The low byte of the sum of all the bytes before the checksum byte.
  • Data format: high 8-bit first, low 8-bit second.

Communication Mechanism

Default power-on state is idle and listening for commands from MCU as a guest The module will not initiate communication and a MCU must take initiative. The TTL level of the serial port is 3.3V. Use a 1K ohm resistor if connecting with a 5V MCU.

jq8400 module pin
Jq8400 Module Pin Details

Code

unsigned short df_wr[] = {0xAA,0,0,0,0,0};
void write_jq_cmd(char cmd, char data_h, char data_l, char len) //jq cmd data {   char m;
  Delay_ms(200);
       df_wr[1]= cmd;
       df_wr[2]= len;
       df_wr[3]= data_h;
       df_wr[4]= data_l;
       df_wr[5]= data_h + data_l + len + df_wr[1] + 0xAA;

    for (m=0; m<6; m++) {      Delay_ms(1);      if(len==0 && m==3) m=5; //(AA 02 00 AC) skip data_h data_l      if(len==1 && m==3) m=4; //(AA 18 01 03 C6) skip data_h      UART1_Write(df_wr[m]);  //aa, cmd, len, dh, dl, sm    }    Delay_ms(10); }

Usage

write_jq_cmd(0x02, 0,0, 0);      //Play write_jq_cmd(0x03, 0,0, 0);      //Pause write_jq_cmd(0x13, 0,27, 1);     //Set volume to 27 write_jq_cmd(0x07, 0x00,0xF4, 2); //Play 244th track write_jq_cmd(0x07, 0x01,0xF4, 2); //Play 500th track write_jq_cmd(0x23, 0x00,0x0A, 2); //FF 10 seconds


Posted By :

Please Note: All contents provided on this blog are for non-commercial purposes only.
Any question..? Feel Free to Ask!

Drop your Comments below. Please report broken links to here
  1. In California, Bay Area Circuits is a well-known PCB manufacturer that designs, fabricates, and assembles printed circuit board prototypes. To know more about the services, capabilities, and certifications, please visit- https://bayareacircuits.com/

    ReplyDelete

 

on line

Labels

Recent comment

Visitors

Free counters!
Copyright © 2012 - Scorpionz™.,All rights reserved | Powered by Blogger