~joshrig/tuna

STM32MP157F experiments
move back to using 16bit samples
fixed a number of bugs causing the scheduler to hang.

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~joshrig/tuna
read/write
git@git.sr.ht:~joshrig/tuna

You can also use your local clone with git send-email.

#Tuna - Experiments on the STM32MP157F-DK2

#Purpose

The code here is not beautiful. It probably isn't even correct. The only purpose of this project is to understand the ST tooling and the hardware itself. Things like CMSIS, OpenAMP, CubeMX, ST drivers...

#Functionality

This code purports to configure the ADC, on the M4, and sample the ANA0 pin, mapped to single-ended ADC channel INP0. DMA is used to ping-pong between buffers. Once a buffer is full, the contents of that buffer are sent to the A7 via IPCC / OpenAMP.

The A7 can send commands to the M4 to start and stop the ADC.

#Installing / Running

Copy the resultant ELF file to the DK2:

scp tuna.elf root@dk2:/lib/firmware

Log into the DK2 and load the firmware:

# stop any existing firmware
echo stop > /sys/class/remoteproc/remoteproc0/state

# tell the driver that name of the firmware you want to load
echo tuna.elf > /sys/class/remoteproc/remoteproc0/firmware

# start the tuna
echo start > /sys/class/remoteproc/remoteproc0/state

# put the tty into raw mode
stty raw -F /dev/ttyRPMSG0

# start generating sample data
echo -n start_adc > /dev/ttyRPMSG0

# you may now read samples from the terminal device.
dd if=/dev/ttyRPMSG0 of=foo bs=256 count=256 iflag=fullblock

To stop the ADC:

echo -n stop_adc > /dev/ttyRPMSG0

Finally, to stop the firmware on the M4:

echo stop > /sys/class/remoteproc/remoteproc0/state

#Notes

You'll need to install the resultant device tree to use the ADC and DMA peripherals. Notes on how to do that are located here:

How to compile the device tree with the Developer Package