Commit Graph

502 Commits

Author SHA1 Message Date
Harald Welte
4a9bce127f qmod: invert WWAN_PERST logic (we use transistors now) 2017-02-10 19:19:52 +01:00
Harald Welte
6732248f71 Add support for board version reading via ADC 2017-02-10 19:19:48 +01:00
Harald Welte
9c78cff10b Extend WWAN modem PERST to 300ms
It seems like a lot of modems have rather long (100ms!) minimum reset
durations.  Makes me wonder if it's an actual reset line or rather juts
some GPIO that they poll/sample every so often.  Then there are other
modems that state the reset *must not* be longer than 1s.  So let's
choose 300ms as a value in-between.
2017-02-04 14:58:49 +01:00
Harald Welte
987f59aa02 Import libosmocore timer infrastructure and use it for PERST
The PERST is thus no longer busy-waiting but starting a timer to release
the PERST after 1ms.
2017-02-04 14:58:45 +01:00
Harald Welte
b41598b602 Introudce an include_libosmocore directory and move (updated) linuxlist there 2017-02-04 12:15:58 +01:00
Harald Welte
7e5c7d5b82 Add debug commands '1' and '2' to generate 1ms reset pulses to modems 2017-02-03 22:59:04 +01:00
Harald Welte
31f817c3ac Add support for controlling PERST of WWAN modems (on qmod) 2017-02-03 22:22:20 +01:00
Harald Welte
83207e0cad Add 'mdelay()' function to busy-wait for given number of milli-seconds 2017-02-03 22:22:17 +01:00
Harald Welte
2819e9c131 wwan_led: Read + report status changes of WWAN LED inputs 2017-02-03 07:49:28 +01:00
Harald Welte
af6147997d qmod: Remove 'U' debug command and directly initialize USB
The hack to manually delay the USB initialization is no longer needed as
finally the USB enumerates.
2017-01-12 18:59:41 +01:00
Harald Welte
fb3f308f2f board_lowlevel: Clean up PLLA configuration
The PLL setting doesn't depend on the 'qmod' board type but on the
combination of the BOARD_MAINOSC and BOARD_MCK #defines.  So let's
remove the '#ifdef qmod' from the equation.

The only 'qmod' specific part is whether or not to use the internal xtal
oscillator or not.
2017-01-12 18:16:23 +01:00
Harald Welte
84ad98585c usb: Cofnigure PLLB according to board.h BOARD_MAINOSC
Actually we don't even need to use PLLB for USB and could simply use
PLLA, but then we don't c are about the extra 2.5mA
2017-01-12 18:06:57 +01:00
Harald Welte
7861132fad qmod: Don't violate PLL minimum output frequency
Table 42-31 ofd DOC6500 states that the minimum output frequency of the
PLL is 60 MHz.   The existing qmod code violated this by configuring the
PLL multiplier output to 12*4 = 48 MHz.  Let's use 12*8 = 96 and then
divide that by two to get to the desired 48 MHz.

This might help to resolve the non-working USB on the qmod so far.
2017-01-12 11:07:04 +01:00
Harald Welte
b871363be7 qmod: cosmetic changes to EEPROM hex array
* move it out of the function so it actually is present in .rodata,
  rather than having a long sequence of stores into a stack buffer
* use 16 bytes per line so it is easier to find + change bits in there
2017-01-11 23:08:35 +01:00
Harald Welte
b30783c83e qmod EEPROM: Dont't mark any ports as non-removable
.. and don't disable any ports during bus-powered operation (which we
don't support anyway).
2017-01-11 23:02:26 +01:00
Harald Welte
ae8a465f36 qmod: Commit missing changes to EEPROM
The firmware we used for testing contained some local changes which were
not committed.  They primarily relate to the port re-ordering feature as
well as the amount of power (0x32 = 100mA) is now used consequently.
2017-01-11 22:59:09 +01:00
Harald Welte
6dfcf70f63 qmod: Start with _HUB_RESET=0 -> HUB_RESET=1 (not in reset)
Booting with the hub reset active would in turn cut our own power
supply as the hub disables all downstream port power in that case.
2017-01-11 22:23:13 +01:00
Harald Welte
f9a182d24d qmod: breal the command loop when 'U' is pressed and proceed to USB init 2017-01-11 22:22:16 +01:00
Harald Welte
afbb747170 qmod: do not automatically clear _HUB_RESET after EEPROM write
we'd rather have explicit control over that
2017-01-11 22:21:28 +01:00
Harald Welte
e07aed6543 qmod: debug menu: Add 'U' command to proceed to USB 2016-12-22 22:32:15 +01:00
Harald Welte
396354cbdb qmod: debug menu: make sure to always print something 2016-12-22 22:29:57 +01:00
Harald Welte
006b16ddc2 quad-modem: Add debug console commands for debugging 2016-12-22 21:29:41 +01:00
Harald Welte
e974fbb9e5 Issue ST12_PRTPWR_OVERRIDE before putting hub in reset
When we reset the hub, the hub will actively drvie the PRTPWR signal of
the SITMRACE12 low, resulting in the SAM3 being shut off.  If we want to
"survive" this, we need to set the OVERRIDE before we go into reset.

Right now, we never release the signal again, keeping ST12 enabled
permanently, which is of course not what we want in general.
2016-10-19 19:36:07 +02:00
Harald Welte
15e026ec34 qmod: Set PIN_PRTPWR_OVERRIDE to output/low 2016-10-11 17:46:09 +02:00
Harald Welte
4e3b9a5140 qmod: attempt to swithc the DN/DP wires of the SAM3 2016-09-05 14:04:43 +02:00
Harald Welte
67415e3385 HACK: Add EEPROM writing at boot of SAM3 on qmod
This is not for production use, but just for hardware verification
2016-09-01 20:57:56 +02:00
Harald Welte
73d697d788 i2c-bitbang: increase speed to ~110kHz 2016-09-01 18:58:41 +02:00
Harald Welte
0aea9fff28 Fix reading SDA in I2C bit-banging code
We need to use pin_sda_in, not pin_sda to read the PIO Input.
2016-09-01 18:39:12 +02:00
Harald Welte
c6ae98c53a i2c_bitbang: Change logic when to use i2c_delay() 2016-09-01 11:57:09 +02:00
Harald Welte
226b40aba4 WIP: bit-banging I2C support for EEPROM access on QMOD
for now, it just continuously reads the EEPROM bytes and dumps them to
the serial console for testing.
2016-08-21 19:33:24 +02:00
Harald Welte
a02b641650 Add support for 'qmod' (quad-modem) board
You can compile the firmware for this new target using 'make
BOARD=qmod'.

The QMOD differs from simtrace+owhw in terms of low-level
initialization, as it has an external 12MHz clock at XIN, thus bypasses
the main oscillator and needs different PLL configuration.
2016-08-21 18:32:12 +02:00
Harald Welte
fd9c041ec8 fix TRACE_ENTRY line termination (LF -> CRLF) 2016-03-20 18:20:14 +01:00
Harald Welte
990f01051f Add HardFault Exception Handler
The HardFault exception handler prints the stacked register as well
as some SCB registers to help debugging even in absence of JTAG.
2016-03-20 18:19:35 +01:00
Harald Welte
e26c943fa1 exceptions: Print name of exception to console 2016-03-20 18:19:18 +01:00
Harald Welte
622b6be774 Fix ADC based VCC detection
* we need to actually return the voltage
* we need to use the correct register name for the CIDR
2016-03-20 18:19:18 +01:00
Harald Welte
3bafe43376 dynamically dispatch USART IRQs
The different modes (configurations) will have different interrupt
handlers, so we need to dispatch them via config_func_ptrs
2016-03-20 18:19:12 +01:00
Harald Welte
dde112e71c print instance/channel number in all trace messages
When debugging issues related to two concurrent SIM card emulations,
it is vital to know to which USART a message relates.
2016-03-20 16:42:11 +01:00
Harald Welte
8ee15dbc2a read SAM3S unique serial number at start and print it 2016-03-20 16:00:39 +01:00
Harald Welte
28772ebcdc ADC: Make errata work-arounds depend on run-time detection of chip version 2016-03-20 15:44:52 +01:00
Harald Welte
1871c25b6d simtrace2-remsim: Instruct SAM3S to simulate card removal on SIGINT
When stopping the program, we inform the card simulator to indicate
a card removal to the GSM phone/modem.
2016-03-20 15:30:46 +01:00
Harald Welte
cf1c19abe0 src_simtrace/main: debug/trace logging improvements 2016-03-20 15:18:18 +01:00
Harald Welte
04e37a8481 firmware/main: Disable the rotor unless TRACE_DEBUG 2016-03-20 15:18:03 +01:00
Harald Welte
5541e8a819 USBD_HAL: Hard-code TRACE_LEVEL_WARNING
we don't want to have USB related messages mess up our console
2016-03-20 15:13:47 +01:00
Harald Welte
9daaa79222 simtrace2-remsim: Send an ATR that allows for a 5MHz/16 divider
This ATR is useful to test higher speeds up to 312500 bits/s
2016-03-20 15:01:20 +01:00
Harald Welte
53079bbbac debug/tracing updates 2016-03-20 14:58:35 +01:00
Harald Welte
c58bba0833 wait for UART Tx completion before switching baud rate at PTS 2016-03-20 14:57:53 +01:00
Harald Welte
c8beefbf85 wait for transmitter to be done before receiving
At higher speeds, it seems we are turning off the transmitter before we
are enabling the receiver.  Unfortunately the TXEN bit in the uart mode
register is read-only, so we don't really know if the transmitter is
enabled or not.  It seems we can simply keep transmitter + reciver
running at the same time, and use the TXEMPTY bit as reliable means to
determine if we're busy transmtting.
2016-03-20 14:40:47 +01:00
Harald Welte
903d63a1e0 card_emu: Alwasys update state before enabling UART Rx/Tx
The UART Rx/Tx irq might hit us before we actually reach the line that
changes the state.  So always update the state before enabling UART
Rx/Tx.
2016-03-20 13:38:39 +01:00
Harald Welte
52d554657c card_emu: Avoid PTS related race-condition
We should not set the new Fi/Di values before we actually transmitted
the PTSS PCK at the old baud rate first.
2016-03-20 13:38:05 +01:00
Harald Welte
ccb8a22037 card_emu: Avoid PTS related race-condition
We should not set the new Fi/Di values before we actually transmitted
the PTSS PCK at the old baud rate first.
2016-03-20 13:37:11 +01:00