This firmware is designed for the MGM240S wireless module, which features the EFR32xG24 SoC, showcasing high-speed ADC data sampling and transmission over BLE. The implementation uses a circular buffer to handle ADC data efficiently, ensuring no data loss, even under high-speed sampling conditions. This setup is generalizable to projects requiring precise ADC sampling, minimal latency, and reliable BLE connectivity.
The ADC pin is connected to a bus designed for interfacing with external sensors (e.g., a microphone). Using the iadc library, the system achieves a sampling frequency of 4 kHz, with BLE advertising and notifications configured for optimal performance. BLE parameters and MTU sizes are also optimized for high-throughput applications.
- Module Compatibility: Designed for the MGM240S wireless module with the EFR32xG24 SoC.
- ADC Sampling:
- Configured for 12-bit resolution.
- Sampling at 4 kHz (adjustable via clock configurations).
- ADC input pin:
gpioPortB
, pin0
.
- Circular Buffer:
- Two halves, each holding 100 samples.
- Flags (
0x1111
and0x0000
) mark buffer boundaries for seamless BLE transmission. - Size customizable via
BUFFER_SIZE
macro.
- BLE Transmission:
- Device advertises with a configurable timeout (default: 60 seconds).
- Notifications sent when buffer halves are full.
- Optimized for high-throughput BLE communication.
- Interrupt-Driven Design:
- ADC interrupts trigger data handling and buffer updates.
- BLE notifications are sent only when a connected device is available.
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make and test your changes.
- Commit (
git commit -m 'Add feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.