I'm writing some time-critical code, but using the KSDK HAL and DRV as a guide.
Wherever possible I'm using the same macros provided by the HAL, most of which seem to use the BME, but here are some cases (like enabling a shifter status interrupt in the FlexIO), where a manual read-modify-write is used so I'm a bit confused why the BME has not been used.
Can anyone shed any light on where it can and can't be used?
Nick
Hi, Nick,
I suppose you use KL family with cortex-M0 plus core, I assume you use Kl27 as an example. pls refer to the section 40.2 Memory map and register definition in the Reference manual of Kl27, "The peripheral address space occupies a 516 KB region: 512 KB based at 0x4000_0000 plus a 4 KB space based at 0x400F_F000 for GPIO accesses", in other words, the address space from 0x4000_0000 to 0x4008_0000 are BME address and plus the 4KB GPIO address space.
Pls refer to the 4.4.1 Peripheral bridge (AIPS-Lite) memory map in RM of Kl27, all peripheral address except for LLWU/PMC/SMC/RCM modules can use BME address.
The FlexIO base address is 0x4005_F000, of course, it is located at the address range from 0x4000_0000 to 0x4008_0000, it can use BME address.
Hope it can help you.
BR
Xiangjun Rong
Hi,
Thanks for the reply.. and also for pointing out I left out important details..
Your assumptions were correct.. I'm using the KL17.
I had read the same section of the reference manual and come to the same conclusion.. it should be possible to use the BME with the FlexIO, which was why I asked the question - it seemed odd that the KSDK (which I would have assumed was written by experts) does not make use if the BME.. which made me wonder if there was some additional situation where it could not be used.
That part of the question still stands.. any idea why it hasn't been used in the KSDK driver code?
Hi, Nick,
Regarding your question why the SDK driver does not use BME to access bit in register, I think using BME method to access bit in peripheral register is troublesome and unnecessary, reading/writting register address directly is straightforward.
I think you can access a bit in FlexIO register with BME metrhod and use debugger to test if the bit has changed as you expected, in this way, you can confirm if the FlexIO register can be accessed by BME method.
you can refer to the an4838 which describes how to use BME method.
Hope it can help you.
BR
Xiangjun Rong