changeset 59:66d99b5be8a3

loudspeaker block implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 01 Dec 2021 04:08:35 +0000
parents 229f0b2dd1bf
children c661a87159c2
files venus/src/MCL venus/src/Makefile venus/src/periph/loudspeaker.v venus/src/top/mobile.v
diffstat 4 files changed, 77 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/venus/src/MCL	Wed Dec 01 03:26:15 2021 +0000
+++ b/venus/src/MCL	Wed Dec 01 04:08:35 2021 +0000
@@ -170,7 +170,7 @@
 
 C319:
  # footprint for possible cap on U302 BYPASS pin
- #hier=spkr.C319
+ hier=mob.spkr.C319
  footprint=0402
  value=DNP
  part=none
@@ -194,21 +194,21 @@
 
 C330:
  # power supply decoupling cap for U302
- #hier=spkr.C330
+ hier=mob.spkr.C330
  value=1uF
  footprint=0402
  npins=2
 
 C331:
  # cap on U302 output
- #hier=spkr.C331
+ hier=mob.spkr.C331
  value=47p
  footprint=0402
  npins=2
 
 C332:
  # cap on U302 output
- #hier=spkr.C332
+ hier=mob.spkr.C332
  value=47p
  footprint=0402
  npins=2
@@ -735,7 +735,7 @@
 
 # Loudspeaker output
 J403:
- #hier=spkr.spkr_connector
+ hier=mob.spkr.spkr_connector
  part=header-2pin
 
 # VSP internal interface tap
@@ -1012,33 +1012,33 @@
 
 R331:
  # U302 feedback resistor
- #hier=spkr.R331
+ hier=mob.spkr.R331
  footprint=0402
  npins=2
 
 R332:
  # U302 feedback resistor
- #hier=spkr.R332
+ hier=mob.spkr.R332
  footprint=0402
  npins=2
 
 R338:
  # pull-down resistor on U302 enable control line
- #hier=spkr.R338
+ hier=mob.spkr.R338
  value=100k
  footprint=0402
  npins=2
 
 R351:
  # U302 input resistor
- #hier=spkr.R33xA
+ hier=mob.spkr.R33xA
  value=10k
  footprint=0402
  npins=2
 
 R352:
  # U302 input resistor
- #hier=spkr.R33xB
+ hier=mob.spkr.R33xB
  value=10k
  footprint=0402
  npins=2
@@ -1418,6 +1418,17 @@
  description=Memory IC, combined flash and pSRAM
  grid_pkg=pkg_TLC056.bgadef
 
+U302:
+ hier=mob.spkr.apa
+ manufacturer=TI
+ device=TPA6203A1GQV
+ description=Audio PA IC, 2x2 mm BGA package
+ part=yes
+ vendor=Digi-Key
+ vendor_part_number=296-12753-1-ND
+ grid_pkg=TPA6203A1-bga.pkg
+ pinout=TPA6203A1-bga.pinmap
+
 U401:
  device=74LVC125A
  manufacturer=Nexperia
--- a/venus/src/Makefile	Wed Dec 01 03:26:15 2021 +0000
+++ b/venus/src/Makefile	Wed Dec 01 04:08:35 2021 +0000
@@ -14,8 +14,9 @@
 	periph/charging_circuit.v periph/charging_led.v \
 	periph/inv_buffer_74LVC1G04.v periph/jtag_if.v periph/keypad.v \
 	periph/keyswitch_wrap.v periph/lcd_module.v periph/lcd_subsystem.v \
-	periph/led_mosfet.v periph/led_npn.v periph/sim_socket_block.v \
-	periph/sim_socket_wrap.v periph/sma_wrap.v periph/trrs_jack.v \
+	periph/led_mosfet.v periph/led_npn.v periph/loudspeaker.v \
+	periph/sim_socket_block.v periph/sim_socket_wrap.v periph/sma_wrap.v \
+	periph/trrs_jack.v \
 	top/board.v top/mobile.v \
 	usb/FT2232D_block.v usb/FT2232D_chip.v usb/eeprom_93Cx6_16bit.v \
 	usb/regulator_ic.v usb/regulator_with_caps.v usb/usb_conn.v \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/venus/src/periph/loudspeaker.v	Wed Dec 01 04:08:35 2021 +0000
@@ -0,0 +1,46 @@
+/* Loudspeaker circuit following Leonardo schematics */
+
+module loudspeaker (GND, VBAT, Input_pos, Input_neg, GPIO_enable);
+
+input GND, VBAT;
+input Input_pos, Input_neg;
+input GPIO_enable;
+
+wire PA_in_pos, PA_in_neg;
+wire Out_pos, Out_neg;
+wire BYPASS;
+
+/* instantiate the audio PA */
+pkg_TPA6203A1 apa (.BYPASS(BYPASS),
+		   .GND(GND),
+		   .In_neg(PA_in_neg),
+		   .In_pos(PA_in_pos),
+		   .SHUTDOWN(GPIO_enable),
+		   .VDD(VBAT),
+		   .Out_pos(Out_pos),
+		   .Out_neg(Out_neg)
+	);
+
+/* input resistors: the inversion is per Leonardo schematics */
+resistor R33xA (Input_pos, PA_in_neg);
+resistor R33xB (Input_neg, PA_in_pos);
+
+/* feedback resistors */
+resistor R331 (Out_neg, PA_in_pos);
+resistor R332 (Out_pos, PA_in_neg);
+
+/* bypass and supply decoupling caps */
+capacitor C319 (BYPASS, GND);
+capacitor C330 (VBAT, GND);
+
+/* small output capacitors */
+capacitor C331 (Out_neg, GND);
+capacitor C332 (Out_pos, GND);
+
+/* the speaker itself! */
+header_2pin spkr_connector (Out_pos, Out_neg);
+
+/* pull-down on the GPIO control line */
+resistor R338 (GPIO_enable, GND);
+
+endmodule
--- a/venus/src/top/mobile.v	Wed Dec 01 03:26:15 2021 +0000
+++ b/venus/src/top/mobile.v	Wed Dec 01 04:08:35 2021 +0000
@@ -223,6 +223,13 @@
 		     .Detect(GPIO6_headset)
 	);
 
+loudspeaker spkr (.GND(GND),
+		  .VBAT(VBAT),
+		  .Input_pos(AUXOP),
+		  .Input_neg(AUXON),
+		  .GPIO_enable(GPIO1_SPKR)
+	);
+
 /* SIM socket */
 sim_socket_block sim (.GND(GND),
 		      .Vio(Vio),