Hello, I recently flashed my firmware to my xiao rp2040 macropad, and while i think i did the firmware correctly, im gonna be honest- ive no idea how to fix this. I read the docs and i still don't understand, i would really appreciate if someone could help me. I've attached m schematic and github repo. Again, I would be super grateful for any help! :) https://github.com/yeetboi-1010/Luca-Macropad/tree/main/Firmware
#Xiao RP2040 Macropad flashed firmware not working
73 messages · Page 1 of 1 (latest)
Can you describe the issue?
what does "not working" mean
yeah. this is very vague
- encoder switch is not mapped to any pin in your firmware
- i2c driver is not configured for the oled
no level shifter for the rgb may be problematic as well. xiao does not have anything on board for this don't think
my apologies, what happens when i plug it in is that the xiao flashes and looks functional, but my oled nor switches nor encoder works
rgb (lighting or matrix) is not enabled in your firmware either,
also i didnt add the rgb leds in real life because i made the pcb wrong
should fixing these resolve the issue?
some of your issues at least, yes. see https://docs.qmk.fm/drivers/i2c#arm-configuration
you also don't have the encoder map feature enabled, so the encoder code in your keymap is not doing anything. this shouldn't prevent the encder from working altogether though, as their is default functionality for it of volume up/down
should i remove the leds from the code if theres no leds present in real life? sorry again, i know everything im asking is probably very vague
i mean i don't see any led-related code. what code are you referring to?
thats mb, i thought i included led code but i forgot that i omitted it cause it made no sense to me
so i know this is very broad, but if you had to pinpoint what you would say to fix, would it just be the i2c stuff and the encoder stuff? like are my keymaps fine or does anything else need fixing?
nothing else stands out that wouldn't work. i would start with configuring the i2c driver appropriately
ok thank you- is qmk the kind of thing where if one thing (like the i2c driver) isn't configured properly, everything wont work? because if not then its kinda weird that nothing else works...
Also make sure you are using the correct pins. The numbers from the ones labeled P(.) are used to my knowledge. https://wiki.seeedstudio.com/XIAO-RP2040/#hardware-overview
The name is still GP(..), only the page omits G
so ive been looking at this article you sent, specifically the arm config section that you included, and im confused- i dont have a halconf.h file, but its telling me to modify it?
You likely want to create it with content similar to this
#pragma once
#define HAL_USE_I2C TRUE
#include_next <halconf.h>
ok so i found some halconf.h files in another directory of qmk_firmware... are these sample ones? each one of the folders has a halfcon.h file
HardwareAbstractionLayerCONFig is for choosing what functionality chibios exposes. (chibios is used for RP2040).
right, but if each of these folders has one of those files, which one am i to use? apolgies for the confusion on my end
I have a working macropad with the same processor that uses the config in qmk_firmware/keyboards/anavi/macropad12. You can look at it as example config.
It uses matrix though.
The directory you found looks more like the hardware setup for each platform (automatically included by selecting processor), but i am unsure since you did not specify the path.
sorry, here's the path C:\Users\user\qmk_firmware\lib\chibios-contrib\testhal
I don't know the inner workings of chibios, but testhal makes me think this includes simple hal config files for testing if chibios works.
So you can use them as reference (specifically the ones under RP)
The ones used there are much more complicated than what you need
so are these adequate? or do i need to edit them? i just copy pasted from the website
`#pragma once
#include_next <mcuconf.h>
#undef STM32_I2C_USE_I2C2
#define STM32_I2C_USE_I2C2 TRUE
`
`#pragma once
#define HAL_USE_I2C TRUE
#include_next <halconf.h>`
Is this supposed to be one file? (Put it in triple ` for multi line environment)
no, sorry. its supposed to be two separate ones. first 4 lines in the mcuconf.h and the last three in the halconf.h
The structure seems correct, but you do not have a STM microcontroller if you have a xiao RP2040
so can i just sub STM32 wherever it is in the code for RP2040
I don't think so.
#undef RP_I2C_USE_I2C1
#define RP_I2C_USE_I2C1 TRUE
Looks similar enough
okay, and also, how do i know whether to use I2C1 , ITC2, etc.?
is it on my schematic?
You will likely need to lookup the processor manual for what hardware units for I²C etc. are present and which pins they can be used with.
Sorry, i meant datasheet.
im so confused :/
The chip has (some don't, so need to look it up) a special part on it that is used to do I²C communication more efficiently. The datasheet lists all information about the chip, and somewhere in there is information about which of possibly multiple such units can be used in which cases.
You wanted to know how to know what the difference between e.g. RP_I2C_USE_I2C0 and RP_I2C_USE_I2C1 is. Those are telling QMK to use a specific such hardware unit. Which of those is better for your purpose depends on their differences, which are explained in detail in the datasheet.
so let's just say i use I2C0. Then what?
is oled screen configuration done and all my code should (hopefully) work?
I don't know what else you changed for enabling oled (you did not push to the repo), but it should be a matter of enabling oled and using it.
I think you are missing the definition what display you are using.
honestly i probably am, i have no idea what im doing 😭
from your schematic, you have sda on I2C0 and scl on I2C1
its not going to work
so is this rectifiable via the code or is my whole pcb just messed up?
You need to connect the clock to the clock and the data to the data pin
otherwise i²c won't work
right, and this is something on the physical hardware that i messed up? and not configurable via code because of how its soldered in real life?
im not sure if thats possible the way i soldered it, could you elaborate please?
You know better than me what is possible, since I have not seen the pcb
Does this help?
Do this to use i2c1 (which to my knowlede supports the pins you used). This does not solve the issue with clock and data swap
#undef RP_I2C_USE_I2C0
#define RP_I2C_USE_I2C0 FALSE
#undef RP_I2C_USE_I2C1
#define RP_I2C_USE_I2C1 TRUE
Maybe you can remove the pin header below clock and data and add flexible wire connecting them with the hole below the other.
im sorry but what is this "clock and data"?
S ClocK and S DAta
i see, so is it necessary if im just wanting the screen to display preset text?
The way i²c works is that it has a clock line where the timing synchronized, and the other connection is for data.
Having them swapped makes no sense, and will not work.
Where you physically swap the connections is up to you, but without the display will do nothing.
so if swapping the physical wires isnt an option for me (because i dont have the expertise nor the hardware to do so), im assuming that means the screen is unusable no matter what in its current state. if so, will deleting all code relating to the screen let me at least use the other functions of my macropad in theory?
I would unplug the screen (should not matter, but makes failure less likely). Removing complexity until something works is a good approach. I think it could work.