When using M5Stack Modules or Bases, many users run into a common problem:
The same module, when stacked on different controllers (such as Basic, Core2, CoreS3, Tab5, etc.), uses different pin definitions. So, how should you correctly configure the pin numbers in your code?
If you have the same question, then understanding how the M5-Bus and DIP switches work is crucial.
This article will explain in a clear and practical way:
- What is M5-Bus
- Fixed Function Pins
- What is a DIP Switch
By the end, you could have a much clearer idea of how to set the DIP switches on the module, and how to configure the corresponding pin numbers in your program.
M5-Bus is a stack expansion bus design adopted by M5Stack stacking series products (Module, Base). The interface uses 2x15P@2.54mm pin headers/sockets. The Core series controllers can quickly stack different modules via the M5-Bus to achieve functional expansion. Its fixed positions define power pins such as GND, 5V, 3V3, and BAT, ensuring compatibility with various devices; other pins vary depending on the controller model, so you need to configure your program according to the actual pin mapping.
2. Fixed Function Pins
The pin numbers of M5-Bus are fixed starting from the GND pin at the top left corner, numbered from 1 to 30. This sequence is consistent across all controllers. The pins marked with a red box are fixed-function pins (power and GND, etc.), while other pins may have different functions or GPIO mappings depending on the main controller.
3. What is a DIP Switch
A DIP Switch is a toggle switch. It is used to flexibly change the connection of key module pins to adapt to different controller models. For example, in the case of Module GPS v2.0, there are three switchable pins: TXD, RXD, and PPS. Two onboard DIP switches control which pins these signals are connected to.
DIP Switch1’s switches 1–4 control TXD, switches 5–8 control RXD; DIP Switch2 is used to control PPS.
To avoid pin conflicts, typically each function pin only needs to be switched to one pin based on actual usage requirements. For example, in the following configuration, the 1st and 5th switches on DIP Switch1 are set to ON, the 2nd switch on DIP Switch2 is set to ON, and all other switches are set to OFF.
Based on the PCB silkscreen reference:
- For Basic, the G17 pin; for Core2, the G14 pin; for CoreS3, the G17 pin will be connected to TXD.
- For Basic, the G16 pin; for Core2, the G13 pin; for CoreS3, the G18 pin will be connected to RXD.
- For Basic/Core2, the G35 pin; for CoreS3, the G10 pin will be connected to PPS.
When programming the device, you must modify the corresponding pin configuration according to the actual pin connections.
The DIP switch’s corresponding positions and numbering connected to the M5-Bus are fixed (indicated by blue box).
If the PCB silkscreen’s I/O reference table does not include the controller model you are currently using, you can refer to the existing device’s silkscreen PinMap to identify which M5-Bus pins the DIP switch connects to, and then map those to the corresponding pins of your current controller.
When using Module LoRa868 with Tab5, and the DIP switches are set as shown in the picture, which Tab5 pins are used for NSS, BUSY, RST, and IRQ, respectively?
Answer

5. Wrapping Up:
Treat the DIP Switch as a “Hardware-Level Remapping Tool”
A DIP switch essentially gives you a form of hardware-level pin remapping:
The same module can be used with different Controllers, while routing key signals (TXD, RXD, PPS, etc.) to the most suitable GPIO pins.
In practice, if the module’s silkscreen or documentation already specifies how to set the DIP switches and which pins to use for your controller (for example, Core2, CoreS3), you can simply:
- Set the DIP switches according to the instructions, and
- Use the same pin numbers in your code as indicated in the documentation.
If your host controller is not listed, you can follow this simple procedure:
-
Check the module silkscreen/documentation
Identify which function each DIP switch group corresponds to. -
Refer to the Controller’s PinMap
Find out which GPIO pins on your current Controller correspond to those M5-Bus pins. -
Set the DIP switches
Ensure that each functional signal is routed to exactly one target pin, avoiding conflicts or duplicate connections. -
Update the pin definitions in your code
Make sure the pins used for UART, interrupts, etc., match the GPIO pins you determined in the previous steps.
Once you understand this workflow, you no longer need to memorize which module “must be used with which Controller.”
Instead, you can flexibly migrate and reuse modules across different controllers, according to your actual needs.









