Hi,
I found a bug in the config tools, with LPC845.
MCUXpresso IDE V11.2.1
LPC845 SDK 2.8
Steps to reproduce:
- create new project for LPC845, include SPI driver
- create configuration .mex
- add SPI peripheral driver
- set "Data width [bits] = 8
- update code
Check configuration in peripherals.c
.dataWidth = 8,
where it should be 7, according to datasheet and example. the way it is done in the SDK example is setting
dataWidth = kSPI_Data8Bits;
which is set to 7 in the enum. basically the result of using the config tools is setting the datawidth to what it is set to + 1.
已解决! 转到解答。
Hi,
let me confirm that there is indeed bug in SPI Peripherals tool component in case of LPC8xx processors - the dataWidth value in spi_slave_config_t is generated incorrectly.
Attached you can find hotfix fixing the issue in Config Tools v8.1 and MCUXpresso IDE 11.2.x.
How to install it:
1. Ensure you have an administrator rights, MCUXpresso Configuration Tools are not running and the MCU data of the MCUs you want to use are available (downloaded) on your desktop.
Note:
MCU data are downloaded from the http://mcuxpresso.nxp.com server. If you want to be sure that data are not updated from the server (when an update is provided by NXP) you can disable updates in following way:
MCUXpresso Configuration Tools: In menu Edit > Preferences select Disabled in the Processor data update option
MCUXpresso IDE: In menu Window > Preferences > MCUXpresso Config Tools select Disabled in the Processor data update option
2. Copy the content of this archive into the tool's data folder:
Windows: c:\ProgramData\NXP\mcu_data_v8
Linux/Mac: /home/<USER>/.nxp/mcu_data_v8
It will be fixed in MCUXpresso Config Tools v9 as well.
Reagards,
Lukas
I did a clean install of everything yesterdasy, so it should be up to date. the bug is still there:
With data width = 8 in Confit Tools:
/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
instance:
- name: 'SPI0'
- type: 'lpc_minispi'
- mode: 'interrupt'
- custom_name_enabled: 'false'
- type_id: 'lpc_minispi_f45b6e04ed20bff9f52c4f4d863b265d'
- functional_group: 'BOARD_InitPeripherals'
- peripheral: 'SPI0'
- config_sets:
- fsl_spi:
- spiConfig:
- spi_mode: 'kSPI_Slave'
- spi_slave_config:
- enableSlave: 'true'
- clockPolarity: 'kSPI_ClockPolarityActiveHigh'
- clockPhase: 'kSPI_ClockPhaseFirstEdge'
- direction: 'kSPI_MsbFirst'
- dataWidth_enum: 'kSPI_Data8Bits'
- sselNumber_: 'kSPI_Ssel0Assert'
- sselPolarity_: ''
- Interrupt_cfg:
- interrupts: 'kSPI_RxReadyInterruptEnable'
- interrupt_vectors:
- enable_rx_tx_irq: 'true'
- interrupt_rx_tx:
- IRQn: 'SPI0_IRQn'
- enable_interrrupt: 'noInit'
- enable_priority: 'false'
- priority: '0'
- enable_custom_name: 'false'
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
/* clang-format on */
const spi_slave_config_t SPI0_config = {
.enableSlave = true,
.clockPolarity = kSPI_ClockPolarityActiveHigh,
.clockPhase = kSPI_ClockPhaseFirstEdge,
.direction = kSPI_MsbFirst,
.dataWidth = 8,
.sselPolarity = kSPI_SpolActiveAllLow
};
but as you can see, the yaml config uses the enum constant, correctly.
header of the peripherals.c file is the following:
/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
!!GlobalInfo
product: Peripherals v8.0
processor: LPC845
package_id: LPC845M301JHI48
mcu_data: ksdk2_0
processor_version: 8.0.2
functionalGroups:
- name: BOARD_InitPeripherals
UUID: 5aeb6b3e-57ce-4419-8db9-9ddcc3918498
called_from_default_init: true
selectedCore: core0
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
SDK is version is 2.8. maybe the bug is only there in slave mode?
Best regards,
Alexis Marquet
Hi,
let me confirm that there is indeed bug in SPI Peripherals tool component in case of LPC8xx processors - the dataWidth value in spi_slave_config_t is generated incorrectly.
Attached you can find hotfix fixing the issue in Config Tools v8.1 and MCUXpresso IDE 11.2.x.
How to install it:
1. Ensure you have an administrator rights, MCUXpresso Configuration Tools are not running and the MCU data of the MCUs you want to use are available (downloaded) on your desktop.
Note:
MCU data are downloaded from the http://mcuxpresso.nxp.com server. If you want to be sure that data are not updated from the server (when an update is provided by NXP) you can disable updates in following way:
MCUXpresso Configuration Tools: In menu Edit > Preferences select Disabled in the Processor data update option
MCUXpresso IDE: In menu Window > Preferences > MCUXpresso Config Tools select Disabled in the Processor data update option
2. Copy the content of this archive into the tool's data folder:
Windows: c:\ProgramData\NXP\mcu_data_v8
Linux/Mac: /home/<USER>/.nxp/mcu_data_v8
It will be fixed in MCUXpresso Config Tools v9 as well.
Reagards,
Lukas