We're evaluating the nrf52840 and I am looking at the SPIM peripheral. The datasheet states the following:
"If several AHB bus masters try to access the same AHB slave at the same time, AHB bus congestion might occur. The SPIM is such an AHB master, and when congestion occurs the SPIM might have to wait for access to RAM to be granted. If the SPIM has to wait for bus access the transaction will be temporary stalled, but resume once the SPIM is granted access to the bus. See the AHB multilayer on page 48 for more information on this subject. Note that some SPIM instances do not support this stalling mechanism.
Refer to Instances on page 379 for information about what features are supported in the various instances."
So SPIM0 though SPIM2 do not support stalling, but SPIM3 does. In the memory section there's more information:
Some peripherals, for example radio, do not have a safe stalling mechanism (no internal data buffering, nor opportunity to pause incoming data). Being a low priority bus master might cause loss of data for such peripherals upon bus contention. To avoid AHB bus contention when using multiple bus masters, apply one of the following guidelines:
- As a good general rule, avoid situations where more than one bus master is accessing the same slave.
- If more than one bus master is accessing the same slave, make sure that the bus bandwidth is not exhausted.
This raised some questions:
1.) RAM memory is divided in multiple AHB-bus slaves if I interpret the diagrams correctly (figure 1 and figure 2 in the Product Spec). Does that mean that contention will NOT happen if I keep my SPIM source data in one of the RAM locations and do not access it with any other Masters?
2.) The CPU is a AHB master as well. If the CPU were to access the RAM block where the SPIM peripheral is reading from, can contention occur?
3.) What does "loss of data" mean? Say I am doing a large SPIM transfer and contention occurs in the middle of the xfer, are some bytes simply not sent or does the entire transfer halt? I'm trying to understand what measures I'd have to take in the code to prevent issues.
4.) Is there any way to detect contention when it occurs?
Thanks,
Dirk